Section 1
//ButtonHandler (amazingadventures.client.ButtonHandler)
package amazingadventures.client {
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
public class ButtonHandler {
public var pressed:int;// = 3
public var func:Function;// = null
public var active:Boolean;// = true
public var currentState:int;
public var off:int;// = 4
public var over:int;// = 2
public var btn:MovieClip;// = null
public var on:int;// = 1
public function ButtonHandler(_arg1:MovieClip){
currentState = on;
super();
this.btn = _arg1;
_arg1.stop();
_arg1.addEventListener(MouseEvent.ROLL_OVER, rollOver);
_arg1.addEventListener(MouseEvent.ROLL_OUT, rollOut);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
_arg1.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
}
public function rollOut(_arg1:MouseEvent):void{
if (active){
if (btn.currentFrame != pressed){
btn.gotoAndStop(currentState);
};
};
}
public function mouseUp(_arg1:MouseEvent):void{
if (active){
Main.main.soundManager.startSound(new ButtonClickSnd(), SoundManager.VOLUME_CLICK);
if (func != null){
func();
};
if (currentState == on){
currentState = off;
} else {
currentState = on;
};
btn.gotoAndStop(currentState);
};
}
public function mouseDown(_arg1:MouseEvent):void{
if (active){
btn.gotoAndStop(pressed);
};
}
public function rollOver(_arg1:MouseEvent):void{
if (active){
Main.main.soundManager.startSound(new ButtonRollOverSnd(), SoundManager.VOLUME_ROLL_OVER);
if (btn.currentFrame != pressed){
btn.gotoAndStop(over);
};
};
}
public function setOnOff(_arg1:Boolean):void{
if (_arg1){
currentState = on;
} else {
currentState = off;
};
btn.gotoAndStop(currentState);
}
}
}//package amazingadventures.client
Section 2
//Clock (amazingadventures.client.Clock)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.display.*;
import flash.text.*;
public class Clock extends Sprite implements Renderable {
private var flashColor:int;// = 0xFF0000
private var color:int;
private var flashTicks:int;// = 30
public var second1:TextField;
public var timeWarning:Boolean;// = false
public var game:Game;
public var second10:TextField;
public var timeDisplay:TimeDisplay;
public var minute1:TextField;
public var colon:TextField;
public function Clock(){
color = second1.textColor;
timeDisplay = new TimeDisplay([second1, second10, minute1], Game.TICKS_PER_SECOND);
}
public function render(_arg1:int, _arg2:Number):int{
timeDisplay.update(game.countDownTicks);
if (timeWarning){
if ((int((_arg1 / flashTicks)) % 2) == 0){
second1.textColor = flashColor;
second10.textColor = flashColor;
colon.textColor = flashColor;
minute1.textColor = flashColor;
} else {
second1.textColor = color;
second10.textColor = color;
colon.textColor = color;
minute1.textColor = color;
};
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 3
//FailAnimation (amazingadventures.client.FailAnimation)
package amazingadventures.client {
import util.*;
import flash.display.*;
public class FailAnimation extends MovieClip implements Renderable {
public var framePlayer:FramePlayer;// = null
public function FailAnimation(_arg1:int, _arg2:int, _arg3:int){
this.x = _arg1;
this.y = _arg2;
framePlayer = new FramePlayer(this, _arg3, 60, 0);
mouseEnabled = false;
}
public function render(_arg1:int, _arg2:Number):int{
if (framePlayer != null){
framePlayer.update(_arg1, _arg2);
if (_arg1 >= framePlayer.endTick){
framePlayer = null;
};
return (Renderer.CONTINUE);
//unresolved jump
};
return (Renderer.STOP_REMOVE);
}
}
}//package amazingadventures.client
Section 4
//FoundAnimation (amazingadventures.client.FoundAnimation)
package amazingadventures.client {
import util.*;
import flash.display.*;
public class FoundAnimation extends Sprite implements Renderable {
public var textItem:TextItem;// = null
public var successAnimation:MovieClip;// = null
public var textItemPlayer:FramePlayer;// = null
public var successFramePlayer:FramePlayer;// = null
public var animationLayer:Sprite;// = null
public var scorePopMovement:Movement;// = null
public var imageMovement:Movement;// = null
public var chainResize:ChainResize;// = null
public var scorePopFader:Fader;// = null
public var image:Image;// = null
public var scorePop:ScorePop;// = null
public function FoundAnimation(_arg1:Sprite, _arg2:Image, _arg3:TextItem, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):void{
this.animationLayer = _arg1;
this.image = _arg2;
this.textItem = _arg3;
var _local9:int = Math.floor((_arg2.width / 2));
var _local10:int = Math.floor((_arg2.height / 2));
x = (_arg2.x + _local9);
y = (_arg2.y + _local10);
_arg2.x = -(_local9);
_arg2.y = -(_local10);
addChild(_arg2);
successAnimation = new SuccessAnimation();
_arg1.addChild(successAnimation);
successAnimation.x = x;
successAnimation.y = y;
_arg1.addChild(this);
scorePop = new ScorePop();
scorePop.init(_arg6, _arg7, _arg8);
var _local11:int = (stage.width - 250);
if (x > _local11){
scorePop.x = _local11;
} else {
scorePop.x = x;
};
scorePop.y = y;
_arg1.addChild(scorePop);
mouseEnabled = false;
_arg2.mouseEnabled = false;
_arg2.mc.mouseEnabled = false;
successAnimation.mouseEnabled = false;
scorePop.mouseEnabled = false;
scorePop.textField.mouseEnabled = false;
successFramePlayer = new FramePlayer(successAnimation, _arg6, 120, 0);
var _local12:int = _arg6;
var _local13 = 120;
scorePopMovement = new Movement(scorePop, _local12, (_local12 + _local13), scorePop.x, scorePop.y, scorePop.x, (scorePop.y - 100));
scorePopFader = new Fader(scorePop, _local12, (_local12 + _local13), 1, 0);
chainResize = new ChainResize(this);
var _local14 = 15;
_local12 = _arg6;
chainResize.addResize(_local12, 1, 1);
_local12 = (_local12 + _local14);
chainResize.addResize(_local12, 1.4, 1.4);
_local12 = (_local12 + _local14);
chainResize.addResize(_local12, 1, 1);
_local12 = (_local12 + _local14);
chainResize.addResize(_local12, 1.4, 1.4);
_local12 = (_local12 + _local14);
chainResize.addResize(_local12, 1, 1);
var _local15 = 35;
imageMovement = new Movement(this, _local12, (_local12 + _local15), x, y, _arg4, _arg5);
_local12 = (_local12 + _local15);
textItemPlayer = new FramePlayer(_arg3.line, _local12, 30, 0);
}
public function render(_arg1:int, _arg2:Number):int{
if (scorePop != null){
if (scorePop.y == scorePopMovement.endY){
animationLayer.removeChild(scorePop);
scorePop = null;
} else {
scorePopMovement.update(_arg1, _arg2);
scorePopFader.update(_arg1, _arg2);
};
};
if (image != null){
if ((((imageMovement.endX == x)) && ((imageMovement.endY == y)))){
removeChild(image);
image = null;
} else {
chainResize.update(_arg1, _arg2);
imageMovement.update(_arg1, _arg2);
};
};
if (successFramePlayer != null){
if (_arg1 > successFramePlayer.endTick){
animationLayer.removeChild(successAnimation);
successFramePlayer = null;
} else {
successFramePlayer.update(_arg1, _arg2);
};
};
textItemPlayer.update(_arg1, _arg2);
if ((((((scorePop == null)) && ((image == null)))) && ((successFramePlayer == null)))){
return (Renderer.STOP_REMOVE);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 5
//GameC (amazingadventures.client.GameC)
package amazingadventures.client {
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class GameC extends Sprite {
public var seedTf:TextField;// = null
public var exitBh:ButtonHandler;// = null
public var extraGameDialog:MiddleGameDialog;// = null
public var musicBh:ButtonHandler;// = null
public var clock:Clock;// = null
public var gameSprite:Sprite;// = null
public var middleBorder:MiddleBorder;// = null
public var bottomBar:BottomBar;// = null
public var dialogLayer:Sprite;// = null
public var animationLayer:Sprite;// = null
public var game:Game;// = null
public var hintBh:ButtonHandler;// = null
public var soundBh:ButtonHandler;// = null
public var topBar:TopBar;// = null
public var shortMode:Boolean;// = false
public static var gameStartsInStr:String;
public static var secondsStr:String;
public function GameC(_arg1:Game){
var game = _arg1;
super();
this.game = game;
if (Main.gameDataXml.@mode == "short"){
shortMode = true;
};
gameSprite = new Sprite();
gameSprite.name = "game sprite";
addChild(gameSprite);
middleBorder = new MiddleBorder();
middleBorder.x = 376;
middleBorder.y = 53;
middleBorder.mouseEnabled = false;
middleBorder.visible = false;
addChild(middleBorder);
topBar = new TopBar();
topBar.sceneNameTf.text = Main.gameDataXml.text.(@id == game.getPlaceName());
topBar.mouseEnabled = false;
if (game.main.relaxMode){
topBar.clock.visible = false;
topBar.relaxHintCountTf.text = ((Main.gameDataXml.text.(@id == "hints") + " ") + game.main.relaxHints);
} else {
topBar.relaxHintCountTf.visible = false;
};
addChild(topBar);
bottomBar = new BottomBar();
bottomBar.slideBar2.visible = false;
bottomBar.y = 566;
addChild(bottomBar);
bottomBar.mouseEnabled = false;
bottomBar.slideBar.mouseEnabled = false;
bottomBar.slideBar2.mouseEnabled = false;
exitBh = new ButtonHandler(bottomBar.exitBtn);
exitBh.btn.addEventListener(MouseEvent.CLICK, gameEnd);
soundBh = new ButtonHandler(bottomBar.soundBtn);
soundBh.setOnOff(game.main.soundManager.getSoundOn());
soundBh.btn.addEventListener(MouseEvent.CLICK, toggleSound);
musicBh = new ButtonHandler(bottomBar.musicBtn);
musicBh.setOnOff(game.main.soundManager.getMusicOn());
musicBh.btn.addEventListener(MouseEvent.CLICK, toggleMusic);
hintBh = new ButtonHandler(bottomBar.hintBtn);
bottomBar.hintBtn.stop();
if (!game.main.relaxMode){
clock = topBar.clock;
clock.game = game;
game.main.renderer.start(clock);
};
animationLayer = new Sprite();
addChild(animationLayer);
animationLayer.mouseEnabled = false;
dialogLayer = new Sprite();
addChild(dialogLayer);
dialogLayer.mouseEnabled = false;
}
public function gameEnd(_arg1:MouseEvent):void{
game.main.addPlayData([Game.INPUT_EXIT]);
}
public function updateRelaxHints():void{
var remainingHints:*;
if (game.main.relaxMode){
remainingHints = game.main.relaxHints;
if (remainingHints < 0){
remainingHints = 0;
};
topBar.relaxHintCountTf.text = ((Main.gameDataXml.text.(@id == "hints") + " ") + remainingHints);
if (game.main.relaxHints <= 0){
hintBh.active = false;
hintBh.setOnOff(false);
};
};
}
public function showExtraGameDialog():void{
extraGameDialog = new MiddleGameDialog(game.startMiniGameTick);
dialogLayer.addChild(extraGameDialog);
extraGameDialog.addEventListener(MouseEvent.CLICK, dialogClicked);
if (game.state == Game.PLACE_START_DIALOG){
extraGameDialog.mini_game_instruction.text = Main.gameDataXml.text.(@id == "place_game_instruction");
} else {
extraGameDialog.mini_game_instruction.text = Main.gameDataXml.text.(@id == "spot_game_instruction");
};
game.main.renderer.start(extraGameDialog);
}
public function timeWarning(_arg1:Boolean):void{
game.main.soundManager.startSound(new TimeWarningSnd(), SoundManager.VOLUME_TIME_WARNING);
if (_arg1){
clock.timeWarning = true;
};
}
public function hintAnimationEnded():void{
if (game.main.relaxMode){
if (game.main.relaxHints > 0){
hintBh.active = true;
hintBh.setOnOff(true);
};
} else {
hintBh.active = false;
hintBh.setOnOff(false);
};
}
public function toggleSound(_arg1:MouseEvent):void{
game.main.addPlayData([Game.INPUT_TOGGLE_SOUND]);
game.main.soundManager.toggleSound();
}
public function updateItemsLeft(_arg1:int):void{
if (_arg1 > 0){
topBar.itemsLeftTf.text = ("" + _arg1);
} else {
topBar.itemsLeftTf.text = "0";
};
}
public function startNext(_arg1:MouseEvent=null):void{
game.main.renderer.stop(extraGameDialog);
dialogLayer.removeChild(extraGameDialog);
}
public function deActivate():void{
hintBh.active = false;
exitBh.btn.removeEventListener(MouseEvent.CLICK, gameEnd);
soundBh.btn.removeEventListener(MouseEvent.CLICK, toggleSound);
musicBh.btn.removeEventListener(MouseEvent.CLICK, toggleMusic);
}
public function dialogClicked(_arg1:MouseEvent):void{
game.main.addPlayData([Game.INPUT_START_NEXT]);
}
public function toggleMusic(_arg1:MouseEvent):void{
game.main.addPlayData([Game.INPUT_TOGGLE_MUSIC]);
game.main.soundManager.toggleMusic();
}
public function start():void{
game.main.addChild(this);
if (!((game.main.relaxMode) && ((game.main.relaxGameNr > 0)))){
game.main.soundManager.gameStart();
};
}
public function updateScoreTf():void{
topBar.scoreTf.text = ("" + game.getCurrentScore());
}
public static function addChildAtByFrame(_arg1:Image, _arg2:DisplayObjectContainer):void{
var _local4:int;
var _local5:Image;
var _local6:int;
var _local3:int = _arg1.mc.currentFrame;
_local4 = 0;
while (_local4 < _arg2.numChildren) {
_local5 = Image(_arg2.getChildAt(_local4));
_local6 = _local5.mc.currentFrame;
if (_local3 < _local6){
break;
};
_local4++;
};
_arg2.addChildAt(_arg1, _local4);
}
}
}//package amazingadventures.client
Section 6
//GameTimer (amazingadventures.client.GameTimer)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.events.*;
import flash.utils.*;
public class GameTimer {
private var unprocessedTime:Number;// = 0
private var lastTime:Number;// = -1
public var renderer:Renderer;
public var game:Game;
private var msPerTick:Number;
public var currentTick:int;// = -1
public var passedTime:Number;// = 0
public var alpha:Number;// = 0
public function GameTimer(_arg1:Number, _arg2:Game, _arg3:Renderer){
msPerTick = (1000 / _arg1);
this.game = _arg2;
this.renderer = _arg3;
}
public function advanceTime(_arg1:Event):void{
if (lastTime == -1){
lastTime = getTimer();
};
var _local2:int = getTimer();
passedTime = (_local2 - lastTime);
lastTime = _local2;
unprocessedTime = (unprocessedTime + passedTime);
var _local3:int = int((unprocessedTime / msPerTick));
unprocessedTime = (unprocessedTime - (_local3 * msPerTick));
var _local4:int;
while (_local4 < _local3) {
currentTick++;
if (game != null){
game.tick(currentTick);
};
_local4++;
};
alpha = (unprocessedTime / msPerTick);
renderer.update(currentTick, alpha);
}
}
}//package amazingadventures.client
Section 7
//GraphicsHalf (amazingadventures.client.GraphicsHalf)
package amazingadventures.client {
import flash.display.*;
public class GraphicsHalf extends Sprite {
public var isRight:Boolean;// = false
public var foreground:Image;// = null
public var theMask:Sprite;// = null
public var background:Image;// = null
public function GraphicsHalf(_arg1:XMLList, _arg2:String, _arg3:Array){
var bgName:String;
var bgXml:XMLList;
var i:int;
var fgName:String;
var fgXml:XMLList;
var image:Image;
var imageXml = _arg1;
var placeName = _arg2;
var objImages = _arg3;
super();
theMask = new Sprite();
theMask.graphics.beginFill(0xFF0000);
theMask.graphics.drawRect(0, 0, 377, 566);
mask = theMask;
bgName = (("sc_" + placeName) + "_background");
bgXml = imageXml.image.(String(@id).indexOf(bgName) != -1);
background = new Image(bgXml);
background.name = "background";
background.x = parseInt(bgXml.@x);
background.y = parseInt(bgXml.@y);
addChild(background);
i = 0;
while (i < objImages.length) {
image = Image(objImages[i]);
addChild(image);
i = (i + 1);
};
fgName = (("sc_" + placeName) + "_foreground");
fgXml = imageXml.image.(String(@id).indexOf(fgName) != -1);
foreground = new Image(fgXml);
foreground.x = parseInt(fgXml.@x);
foreground.y = parseInt(fgXml.@y);
foreground.mouseDisable();
GameC.addChildAtByFrame(foreground, this);
}
}
}//package amazingadventures.client
Section 8
//HintAnimation (amazingadventures.client.HintAnimation)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.display.*;
import flash.geom.*;
public class HintAnimation extends MovieClip implements Renderable {
public var gameC:GameC;
public var framePlayer:FramePlayer;// = null
public function HintAnimation(_arg1:GameC){
this.gameC = _arg1;
mouseEnabled = false;
}
public function render(_arg1:int, _arg2:Number):int{
if (framePlayer != null){
framePlayer.update(_arg1, _arg2);
if (_arg1 >= framePlayer.endTick){
framePlayer = null;
};
return (Renderer.CONTINUE);
//unresolved jump
};
gameC.hintAnimationEnded();
return (Renderer.STOP_REMOVE);
}
public function miniGameInit(_arg1:Point, _arg2:Obj, _arg3:int):void{
var _local4:int = Math.floor((_arg2.c.left.mc.width / 2));
var _local5:int = Math.floor((_arg2.c.left.mc.height / 2));
x = (_arg1.x + _local4);
y = (_arg1.y + _local5);
var _local6 = 90;
if (Main.IS_DELUXE){
_local6 = 140;
};
framePlayer = new FramePlayer(this, _arg3, _local6, 0);
}
public function spyInit(_arg1:Obj, _arg2:int):void{
var _local3:int = Math.floor((_arg1.c.left.mc.width / 2));
var _local4:int = Math.floor((_arg1.c.left.mc.height / 2));
x = (_arg1.c.x + _local3);
y = (_arg1.c.y + _local4);
var _local5 = 90;
if (Main.IS_DELUXE){
_local5 = 140;
};
framePlayer = new FramePlayer(this, _arg2, _local5, 0);
}
}
}//package amazingadventures.client
Section 9
//Image (amazingadventures.client.Image)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class Image extends Sprite {
protected var data:XMLList;
public var frame:int;
public var bitmap:Bitmap;
public var state:int;// = -1
public var mc:MovieClip;
public var bitmapData:BitmapData;
public static const FOUND_ANIMATION_2:int = 1;
public static const FOUND_ANIMATION_1:int = 0;
public static const NOT_SET:int = -1;
public static var main:Main;
public static var imageClass:Class;
public static var retryLoader:RetryLoader;
private static var loadTimer:Timer;
public function Image(_arg1:String){
mc = MovieClip(new Image.imageClass());
var _local2:String = _arg1.replace("img", "");
_local2 = _local2.replace(".png", "");
mc.gotoAndStop((parseInt(_local2) + 1));
addChild(mc);
var _local3:Rectangle = new Rectangle(0, 0, mc.width, mc.height);
bitmapData = new BitmapData(mc.width, mc.height, true, 0);
bitmapData.draw(mc, null, null, null, _local3, false);
frame = mc.currentFrame;
}
public function testHit(_arg1:int, _arg2:int):Boolean{
var _local3:Point = globalToLocal(new Point(_arg1, _arg2));
var _local4:int = int(_local3.x);
var _local5:int = int(_local3.y);
var _local6 = 5;
var _local7 = 2;
var _local8:Array = [0, -(_local6), 0, _local6, 0, _local7, _local7, -(_local7), -(_local7)];
var _local9:Array = [-(_local6), 0, 0, 0, _local6, _local7, -(_local7), _local7, -(_local7)];
var _local10:int;
while (_local10 < _local8.length) {
if (bitmapPixelHit((_local4 + int(_local8[_local10])), (_local5 + int(_local9[_local10])))){
return (true);
};
_local10++;
};
return (false);
}
public function mouseDisable():void{
mouseEnabled = false;
mc.mouseEnabled = false;
}
public function bitmapPixelHit(_arg1:int, _arg2:int):Boolean{
var _local3 = ((bitmapData.getPixel32(_arg1, _arg2) >> 24) & 0xFF);
if (_local3 >= 50){
return (true);
};
return (false);
}
public static function loadFail(_arg1:ReLoader):void{
main.loadFail();
}
public static function loadHandler(_arg1:Event):void{
if (retryLoader.failed){
loadTimer.stop();
} else {
if (retryLoader.progress == 100){
loadTimer.stop();
imageClass = Class(retryLoader.loader.contentLoaderInfo.applicationDomain.getDefinition("Image"));
main.graphicsLoaded();
};
};
}
public static function loadSuccess(_arg1:ReLoader):void{
imageClass = Class(_arg1.loader.contentLoaderInfo.applicationDomain.getDefinition("Image"));
main.graphicsLoaded();
}
public static function LoadSwf(_arg1:Main, _arg2:String):void{
var _local3:ReLoader;
Image.main = _arg1;
if (_arg1.relaxMode){
_local3 = new ReLoader(Image, _arg2);
_local3.load();
} else {
retryLoader = new RetryLoader(_arg2);
retryLoader.load();
loadTimer = new Timer(200, 0);
loadTimer.start();
loadTimer.addEventListener("timer", loadHandler);
};
}
}
}//package amazingadventures.client
Section 10
//Intro (amazingadventures.client.Intro)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
public class Intro extends Sprite implements Renderable {
private var countDownSec:int;
public var popCapLogo:PopCapLogo;
private var endTick:int;
private var enableStartTick:int;// = -1
public var kingLogo:KingLogo;
private var countDownTicks:int;// = 900
private var startTick:int;// = -1
private var showInstr:Boolean;// = false
public var introBook:IntroBook;
public var introLogo:IntroLogo;
private var main:Main;
private var instructionSecs:int;// = 13
public function Intro(_arg1:Main){
if (Main.IS_DELUXE){
countDownTicks = (13 * Game.TICKS_PER_SECOND);
instructionSecs = 11;
};
this.main = _arg1;
introBook.visible = false;
addEventListener(MouseEvent.CLICK, showInstructions);
}
public function showInstructions(_arg1:Event=null):void{
showInstr = true;
this.removeEventListener(MouseEvent.CLICK, showInstructions);
}
public function init():void{
GameC.gameStartsInStr = Main.gameDataXml.text.(@id == "game_starts_in");
GameC.secondsStr = Main.gameDataXml.text.(@id == "seconds");
Translator.translateTextfields(this);
if (main.relaxMode){
introBook.instruction_1_.text = Main.gameDataXml.text.(@id == "instruction_1_relax_");
};
main.renderer.start(this);
}
public function render(_arg1:int, _arg2:Number):int{
if (startTick == -1){
startTick = _arg1;
endTick = (startTick + countDownTicks);
};
var _local3:int = ((endTick - _arg1) / Game.TICKS_PER_SECOND);
if (_local3 < 0){
_local3 = 0;
};
if (_local3 != countDownSec){
countDownSec = _local3;
if ((((countDownSec < instructionSecs)) || (showInstr))){
if (introBook.visible == false){
introBook.visible = true;
if (introLogo != null){
introLogo.visible = false;
};
enableStartTick = (_arg1 + Math.floor((Game.TICKS_PER_SECOND / 2)));
};
introBook.countDownTf.text = ((((GameC.gameStartsInStr + " ") + countDownSec) + " ") + GameC.secondsStr);
};
};
if (((!((enableStartTick == -1))) && ((_arg1 > enableStartTick)))){
addEventListener(MouseEvent.CLICK, start);
enableStartTick = -1;
};
if (_arg1 >= endTick){
main.startGame();
return (Renderer.STOP_REMOVE);
};
return (Renderer.CONTINUE);
}
protected function start(_arg1:MouseEvent):void{
removeEventListener(MouseEvent.CLICK, start);
endTick = 0;
}
}
}//package amazingadventures.client
Section 11
//MiddleGameDialog (amazingadventures.client.MiddleGameDialog)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class MiddleGameDialog extends Sprite implements Renderable {
public var countDownSec:int;// = 1000
public var countDownTf:TextField;
public var mini_game_instruction:TextField;
public var gameStartsInStr:String;// = ""
public var middle_dialog_title_:TextField;
public var endTick:int;
public var main:Main;// = null
public var you_found_all_:TextField;
public function MiddleGameDialog(_arg1:int, _arg2:Boolean=false, _arg3:Main=null){
var endTick = _arg1;
var loadingNewPlace = _arg2;
var main = _arg3;
super();
this.main = main;
this.endTick = endTick;
Translator.translateTextfields(this);
if (loadingNewPlace){
main.middleGameDialogStarted();
mini_game_instruction.text = Main.gameDataXml.text.(@id == "new_place");
countDownTf.text = Main.gameDataXml.text.(@id == "loading");
};
gameStartsInStr = Main.gameDataXml.text.(@id == "game_starts_in");
}
public function nextRelaxGameLodaded():void{
addEventListener(MouseEvent.CLICK, main.startGame);
main.renderer.start(this);
}
public function destroy():void{
if (main.relaxMode){
main.renderer.stop(this);
};
removeEventListener(MouseEvent.CLICK, main.startGame);
}
public function render(_arg1:int, _arg2:Number):int{
if ((((endTick == -1)) && (main.relaxMode))){
endTick = (_arg1 + (7 * Game.TICKS_PER_SECOND));
};
var _local3:int = ((endTick - _arg1) / Game.TICKS_PER_SECOND);
if (_local3 != countDownSec){
countDownSec = _local3;
countDownTf.text = ((((gameStartsInStr + " ") + countDownSec) + " ") + GameC.secondsStr);
};
if ((((_arg1 >= endTick)) && (main.relaxMode))){
main.startGame();
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 12
//ObjC (amazingadventures.client.ObjC)
package amazingadventures.client {
import amazingadventures.*;
import flash.display.*;
public class ObjC {
public var container:Sprite;// = null
public var left:Image;// = null
public var obj:Obj;// = null
public var x:int;// = 0
public var y:int;// = 0
public var image:String;// = ""
public var right:Image;// = null
public function ObjC(_arg1:Obj, _arg2:XMLList){
this.obj = _arg1;
image = _arg2;
x = parseInt(_arg2.@x);
y = parseInt(_arg2.@y);
}
public function spyCleanUp():void{
if (container.contains(left)){
container.removeChild(left);
};
left = null;
}
public function spotInit():void{
left = new Image(image);
left.x = x;
left.y = y;
left.name = obj.id;
right = new Image(image);
right.x = x;
right.y = y;
right.name = obj.id;
}
public function spyInit(_arg1:Sprite):void{
this.container = _arg1;
left = new Image(image);
left.x = x;
left.y = y;
_arg1.addChild(left);
}
public function click(_arg1:int, _arg2:int):Boolean{
return (left.testHit(_arg1, _arg2));
}
public function hit(_arg1:int, _arg2:int):void{
obj.game.main.addPlayData([Game.THING_CLICKED, obj.nr, _arg1, _arg2]);
}
public function placeInit():void{
left = new Image(image);
left.x = x;
left.y = y;
right = new Image(image);
right.x = x;
right.y = y;
}
}
}//package amazingadventures.client
Section 13
//Outro (amazingadventures.client.Outro)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Outro extends Sprite implements Renderable {
public var register_to_play_:TextField;
public var speed_bonus_:TextField;
public var gameQuitSent:Boolean;// = false
public var speed_bonus_2:TextField;
public var score_1_:TextField;
public var unused_hints_:TextField;
public var startTick:int;
public var scoreAnimations:Array;// = null
public var countDownTf:TextField;
public var endTick:int;
public var speedBonusTf:TextField;
public var outroFading:Boolean;// = false
public var speedBonus2Tf:TextField;
public var score1Tf:TextField;
public var level_2:TextField;
public var penaltiesTf:TextField;
public var relax2Tf:TextField;
public var relax4Tf:TextField;
public var totalScoreTf:TextField;
public var relax_1:TextField;
public var relax_2:TextField;
public var relax_3:TextField;
public var score_2:TextField;
public var relax_5:TextField;
public var main:Main;// = null
public var hintTf:TextField;
public var relax_4:TextField;
public var penalties_:TextField;
public var time_bonus_:TextField;
public var underline1:Sprite;
public var underline2:Sprite;
public var level_1_:TextField;
public var timeBonusTf:TextField;
public var total_score_:TextField;
public var gameEndsInStr:String;
public var score2Tf:TextField;
public var relax1Tf:TextField;
public var relax5Tf:TextField;
public var relax3Tf:TextField;
public var countDownSeconds:int;// = -1
public var game_over_:TextField;
public static const TICKS:int = 1260;
public static const MINIMAL_GAME_QUIT_DELAY:int = 120;
public static const SHORT_MODE_TICKS:int = 240;
public function Outro(_arg1:Game){
var drawTick:int;
var wait:int;
var gameNr:int;
var nameTf:TextField;
var placeNr:int;
var scoreTf:TextField;
var score:int;
var tick:int;
var interval:int;
var game = _arg1;
super();
this.main = game.main;
this.startTick = game.main.gameTimer.currentTick;
endTick = (startTick + Outro.TICKS);
Translator.translateTextfields(this);
if (game.endReason == Game.TIME_RAN_OUT){
game_over_.text = Main.gameDataXml.text.(@id == "time_is_up");
} else {
if (game.endReason == Game.COMPLETED){
game_over_.text = Main.gameDataXml.text.(@id == "game_completed");
} else {
if (game.endReason == Game.RELAX_COMPLETE){
game_over_.text = Main.gameDataXml.text.(@id == "game_completed");
} else {
if (game.endReason == Game.RELAX_LAST_MISS){
game_over_.text = Main.gameDataXml.text.(@id == "last_miss_used");
};
};
};
};
relax_1.visible = false;
relax_2.visible = false;
relax_3.visible = false;
relax_4.visible = false;
relax_5.visible = false;
relax1Tf.visible = false;
relax2Tf.visible = false;
relax3Tf.visible = false;
relax4Tf.visible = false;
relax5Tf.visible = false;
gameEndsInStr = Main.gameDataXml.text.(@id == "game_ends_in_");
if (main.relaxMode){
register_to_play_.visible = false;
level_1_.visible = false;
underline1.visible = false;
score_1_.visible = false;
score1Tf.visible = false;
speed_bonus_.visible = false;
speedBonusTf.visible = false;
level_2.visible = false;
underline2.visible = false;
score_2.visible = false;
score2Tf.visible = false;
speed_bonus_2.visible = false;
speedBonus2Tf.visible = false;
time_bonus_.visible = false;
timeBonusTf.visible = false;
penalties_.visible = false;
penaltiesTf.visible = false;
drawTick = game.main.gameTimer.currentTick;
wait = 7;
scoreAnimations = new Array();
gameNr = 0;
while (gameNr <= main.relaxGameNr) {
nameTf = TextField(this.getChildByName(("relax_" + (gameNr + 1))));
nameTf.visible = true;
placeNr = int(XMLList(main.relaxDataXml[gameNr]).@placenr);
if (Main.IS_DELUXE){
nameTf.text = Main.gameDataXml.text.(@id == Game.DELUXE_PLACES[placeNr]);
} else {
nameTf.text = Main.gameDataXml.text.(@id == main.game.getPlaceName());
};
scoreTf = TextField(this.getChildByName((("relax" + (gameNr + 1)) + "Tf")));
scoreTf.visible = true;
scoreTf.text = "";
score = int(main.relaxScores[gameNr]);
scoreAnimations.push(new ScoreAnimation(scoreTf, score, drawTick, game.main.soundManager));
drawTick = (drawTick + (ScoreAnimation.TICKS + wait));
gameNr = (gameNr + 1);
};
hintTf.text = "";
scoreAnimations.push(new ScoreAnimation(hintTf, main.relaxUnusedHintsScore, drawTick, game.main.soundManager));
drawTick = (drawTick + (ScoreAnimation.TICKS + wait));
totalScoreTf.text = "";
scoreAnimations.push(new ScoreAnimation(totalScoreTf, main.relaxTotalScore, drawTick, game.main.soundManager));
game.main.soundManager.gameEnd();
} else {
if (game.c.shortMode){
endTick = (startTick + Outro.SHORT_MODE_TICKS);
score_2.text = score_1_.text;
speed_bonus_2.text = speed_bonus_.text;
level_2.visible = false;
score_2.visible = false;
score2Tf.visible = false;
speed_bonus_2.visible = false;
speedBonus2Tf.visible = false;
unused_hints_.visible = false;
hintTf.visible = false;
timeBonusTf.visible = false;
underline2.visible = false;
time_bonus_.visible = false;
score1Tf.text = ("" + game.spyGame.score);
speedBonusTf.text = ("" + game.spyGame.speedBonus);
hintTf.text = ("" + game.hintScore);
timeBonusTf.text = ("" + game.timeBonus);
penaltiesTf.text = ("" + -(game.penalties));
totalScoreTf.text = ("" + game.totalScore);
} else {
score_2.text = score_1_.text;
speed_bonus_2.text = speed_bonus_.text;
score1Tf.text = "";
speedBonusTf.text = "";
register_to_play_.visible = false;
if ((game.miniGame is PlaceGame)){
level_2.text = Main.gameDataXml.text.(@id == "place_game_");
score2Tf.text = "";
speedBonus2Tf.text = "";
} else {
if ((game.miniGame is SpotGame)){
level_2.text = Main.gameDataXml.text.(@id == "spot_game_");
score2Tf.text = "";
speedBonus2Tf.text = "";
} else {
level_2.visible = false;
score_2.visible = false;
score2Tf.visible = false;
speed_bonus_2.visible = false;
speedBonus2Tf.visible = false;
};
};
hintTf.text = "";
timeBonusTf.text = "";
penaltiesTf.text = "";
totalScoreTf.text = "";
game.main.soundManager.gameEnd();
tick = game.main.gameTimer.currentTick;
interval = 7;
scoreAnimations = new Array();
scoreAnimations.push(new ScoreAnimation(score1Tf, game.spyGame.score, tick, game.main.soundManager));
if (game.spyGame.speedBonus > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(speedBonusTf, game.spyGame.speedBonus, tick, game.main.soundManager));
if ((game.miniGame is PlaceGame)){
if (game.placeGame.score > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(score2Tf, game.placeGame.score, tick, game.main.soundManager));
if (game.placeGame.speedBonus > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(speedBonus2Tf, game.placeGame.speedBonus, tick, game.main.soundManager));
} else {
if ((game.miniGame is SpotGame)){
if (game.spotGame.score > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(score2Tf, game.spotGame.score, tick, game.main.soundManager));
if (game.spotGame.speedBonus > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(speedBonus2Tf, game.spotGame.speedBonus, tick, game.main.soundManager));
};
};
if (game.hintScore > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(hintTf, game.hintScore, tick, game.main.soundManager));
if (game.timeBonus > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(timeBonusTf, game.timeBonus, tick, game.main.soundManager));
if (game.penalties < 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(penaltiesTf, -(game.penalties), tick, game.main.soundManager));
if (game.totalScore > 0){
tick = (tick + (ScoreAnimation.TICKS + interval));
};
scoreAnimations.push(new ScoreAnimation(totalScoreTf, game.totalScore, tick, game.main.soundManager));
};
};
addEventListener(MouseEvent.CLICK, gameQuit);
}
public function render(_arg1:int, _arg2:Number):int{
if (_arg1 >= (endTick - Outro.MINIMAL_GAME_QUIT_DELAY)){
if (!outroFading){
outroFading = true;
main.soundManager.outroFadeOut();
};
};
if ((((_arg1 >= endTick)) && (!(gameQuitSent)))){
main.gameQuit();
gameQuitSent = true;
countDownTf.text = ((((gameEndsInStr + " ") + 0) + " ") + GameC.secondsStr);
return (Renderer.STOP);
};
var _local3:int = (endTick - _arg1);
var _local4:int = (_local3 / Game.TICKS_PER_SECOND);
if (countDownSeconds != _local4){
countDownSeconds = _local4;
if (countDownSeconds >= 0){
countDownTf.text = ((((gameEndsInStr + " ") + countDownSeconds) + " ") + GameC.secondsStr);
};
};
return (Renderer.CONTINUE);
}
public function gameQuit(_arg1:MouseEvent):void{
var _local4:ScoreAnimation;
var _local2:int;
while (_local2 < scoreAnimations.length) {
_local4 = ScoreAnimation(scoreAnimations[_local2]);
main.renderer.stop(_local4);
_local4.textField.text = ("" + _local4.score);
_local2++;
};
var _local3:int = main.gameTimer.currentTick;
if (_local3 > (startTick + Outro.MINIMAL_GAME_QUIT_DELAY)){
endTick = (_local3 + Outro.MINIMAL_GAME_QUIT_DELAY);
} else {
endTick = (startTick + Outro.MINIMAL_GAME_QUIT_DELAY);
};
if (!outroFading){
outroFading = true;
main.soundManager.outroFadeOut();
};
removeEventListener(MouseEvent.CLICK, gameQuit);
}
public function destroy():void{
removeEventListener(MouseEvent.CLICK, main.startGame);
}
}
}//package amazingadventures.client
Section 14
//PlaceFailAnimation (amazingadventures.client.PlaceFailAnimation)
package amazingadventures.client {
import util.*;
import flash.display.*;
import flash.geom.*;
public class PlaceFailAnimation implements Renderable {
public var imageSprite:Sprite;// = null
public var resize:ChainResize;// = null
public var placeGameC:PlaceGameC;// = null
public var movement:Movement;// = null
public function PlaceFailAnimation(_arg1:Sprite, _arg2:PlaceGameC, _arg3:int, _arg4:Point, _arg5:Number){
this.imageSprite = _arg1;
this.placeGameC = _arg2;
movement = new Movement(_arg1, _arg3, (_arg3 + 25), _arg1.x, _arg1.y, _arg4.x, _arg4.y);
resize = new ChainResize(_arg1);
resize.addResize(_arg3, _arg1.scaleX, _arg1.scaleY);
resize.addResize((_arg3 + 25), _arg5, _arg5);
}
public function render(_arg1:int, _arg2:Number):int{
if (movement != null){
if (_arg1 >= movement.endTick){
movement = null;
} else {
resize.update(_arg1, _arg2);
movement.update(_arg1, _arg2);
};
} else {
placeGameC.returnImageSpriteToSlider(imageSprite);
return (Renderer.STOP);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 15
//PlaceGameC (amazingadventures.client.PlaceGameC)
package amazingadventures.client {
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class PlaceGameC {
public var slideImages:Sprite;// = null
public var draggedSpriteDepth:int;// = -1
public var slideBar2:SlideBar2;// = null
public var draggedSpriteScale:Number;// = 1
public var gameSprite:Sprite;// = null
public var placeGame:PlaceGame;// = null
public var missingSide:int;
public var leftHalf:GraphicsHalf;// = null
public var draggedSpritePoint:Point;// = null
public var animationLayer:Sprite;// = null
public var rightHalf:GraphicsHalf;// = null
public var draggedSprite:Sprite;// = null
public function PlaceGameC(_arg1:PlaceGame){
var _local9:Obj;
var _local10:Obj;
super();
this.placeGame = _arg1;
this.slideBar2 = _arg1.game.c.bottomBar.slideBar2;
this.gameSprite = _arg1.game.c.gameSprite;
this.animationLayer = _arg1.game.c.animationLayer;
slideImages = new Sprite();
slideImages.x = 75;
slideImages.y = 51;
slideBar2.addChild(slideImages);
var _local2:Array = new Array();
var _local3:Array = new Array();
var _local4:int;
while (_local4 < _arg1.objs.size()) {
_local9 = Obj(_arg1.objs.g(_local4));
_local9.c.placeInit();
if (_arg1.leftObjs.indexOf(_local9) == -1){
_local2.push(_local9.c.left);
};
if (_arg1.rightObjs.indexOf(_local9) == -1){
_local3.push(_local9.c.right);
};
_local4++;
};
var _local5:int;
while (_local5 < _arg1.excludedObjs.size()) {
_local10 = Obj(_arg1.excludedObjs.g(_local5));
if (_arg1.leftObjs.indexOf(_local10) != -1){
makeImageSprite(_local10.c.left, _local10.id);
};
if (_arg1.rightObjs.indexOf(_local10) != -1){
makeImageSprite(_local10.c.right, _local10.id);
};
_local5++;
};
updateSlideBar();
var _local6:XMLList = Main.gameDataXml.images;
var _local7:String = _arg1.game.getPlaceName();
leftHalf = new GraphicsHalf(_local6, _local7, _local2);
var _local8:int = (_arg1.sideOfScene * -378);
leftHalf.x = (_local8 - 2);
gameSprite.addChild(leftHalf);
rightHalf = new GraphicsHalf(_local6, _local7, _local3);
rightHalf.x = ((_local8 + 378) + 1);
rightHalf.theMask.x = 378;
gameSprite.addChild(rightHalf);
slideBar2.visible = true;
_arg1.game.c.middleBorder.visible = true;
if (!_arg1.game.hintUsed){
_arg1.game.c.hintBh.func = hintClicked;
_arg1.game.c.hintBh.active = true;
};
_arg1.game.c.updateItemsLeft(_arg1.excludedObjs.size());
if (_arg1.game.main.relaxMode){
_arg1.game.c.updateRelaxHints();
};
}
public function deActivateDrag(_arg1:Sprite):void{
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, imageDrag);
}
public function makeImageSprite(_arg1:Image, _arg2:String):void{
_arg1.x = 0;
_arg1.y = 0;
var _local3:Sprite = new Sprite();
activateDrag(_local3);
_local3.name = _arg2;
_local3.addChild(_arg1);
_arg1.x = -(Math.floor((_local3.width / 2)));
_arg1.y = -(Math.floor((_local3.height / 2)));
var _local4:Number = 62;
var _local5:Number = 1;
var _local6:Number = _arg1.width;
if (_arg1.height > _arg1.width){
_local6 = _arg1.height;
};
if (_local6 > _local4){
_local5 = (_local6 / _local4);
_local5 = (1 / _local5);
};
_local3.scaleX = _local5;
_local3.scaleY = _local5;
slideImages.addChild(_local3);
}
public function animatePutBack(_arg1:int):void{
var _local2:PlaceFailAnimation = new PlaceFailAnimation(draggedSprite, this, _arg1, draggedSpritePoint, draggedSpriteScale);
placeGame.game.main.renderer.start(_local2);
}
public function activateDrag(_arg1:Sprite):void{
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, imageDrag);
}
public function updateSlideBar():void{
var _local3:Sprite;
var _local1:int;
while (_local1 < slideImages.numChildren) {
_local3 = Sprite(slideImages.getChildAt(_local1));
_local3.x = (_local1 * 67);
_local3.y = 0;
_local1++;
};
var _local2:int = (PlaceGame.NO_THINGS_TO_PLACE - slideImages.numChildren);
slideImages.x = (75 + (_local2 * 32));
}
public function returnImageSpriteToSlider(_arg1):void{
slideImages.addChildAt(_arg1, draggedSpriteDepth);
updateSlideBar();
activateDrag(_arg1);
}
public function cleanUp():void{
var _local1:DisplayObject;
while (slideImages.numChildren > 0) {
_local1 = slideImages.getChildAt(0);
if ((_local1 is Sprite)){
deActivateDrag(Sprite(_local1));
};
slideImages.removeChild(_local1);
};
}
public function animateSuccess(_arg1:int, _arg2:int):void{
var _local3:GraphicsHalf = leftHalf;
if (missingSide == 1){
_local3 = rightHalf;
};
var _local4:Image = Image(draggedSprite.getChildAt(0));
_local4.x = placeGame.draggedObj.c.x;
_local4.y = placeGame.draggedObj.c.y;
GameC.addChildAtByFrame(_local4, _local3);
var _local5:Point = _local3.localToGlobal(new Point(_local4.x, _local4.y));
_local3.localToGlobal(new Point(_local4.x, _local4.y)).x = (_local5.x + Math.floor((_local4.width / 2)));
_local5.y = (_local5.y + Math.floor((_local4.height / 2)));
var _local6:SuccessAnimation = new SuccessAnimation();
animationLayer.addChild(_local6);
_local6.x = _local5.x;
_local6.y = _local5.y;
_local6.init(placeGame.game.main.gameTimer.currentTick);
placeGame.game.main.renderer.start(_local6);
var _local7:ScorePop = new ScorePop();
_local7.x = _local5.x;
var _local8:int = (755 - 150);
if (_local7.x > _local8){
_local7.x = _local8;
};
_local7.y = _local5.y;
animationLayer.addChild(_local7);
_local7.init(placeGame.game.main.gameTimer.currentTick, _arg1, _arg2);
placeGame.game.main.renderer.start(_local7);
placeGame.game.c.updateScoreTf();
placeGame.game.c.updateItemsLeft(placeGame.excludedObjs.size());
Main.main.soundManager.startSound(new MiniGameMatchSnd(), SoundManager.VOLUME_MINI_GAME_MATCH);
}
public function hintClicked(_arg1:Event=null):void{
placeGame.game.main.addPlayData([Game.INPUT_HINT]);
placeGame.game.c.hintBh.active = false;
Main.main.soundManager.startSound(new HintSnd(), SoundManager.VOLUME_HINT);
}
public function animateFailure(_arg1:int, _arg2:int):void{
var _local4:ScorePop;
var _local5:int;
var _local3:PlaceFailAnimation = new PlaceFailAnimation(draggedSprite, this, _arg1, draggedSpritePoint, draggedSpriteScale);
placeGame.game.main.renderer.start(_local3);
if (_arg2 < 0){
_local4 = new ScorePop();
animationLayer.addChild(_local4);
_local5 = (755 - 50);
if (draggedSprite.x > _local5){
_local4.x = _local5;
} else {
_local4.x = draggedSprite.x;
};
_local4.y = draggedSprite.y;
_local4.init(placeGame.game.main.gameTimer.currentTick, _arg2, 0);
placeGame.game.main.renderer.start(_local4);
};
placeGame.game.c.updateScoreTf();
Main.main.soundManager.startSound(new PenaltySnd(), SoundManager.VOLUME_PENALTY);
}
public function imageDrop(_arg1:MouseEvent):void{
var _local5:GraphicsHalf;
var _local6:Image;
draggedSprite.removeEventListener(MouseEvent.MOUSE_DOWN, imageDrop);
draggedSprite.stopDrag();
var _local2:int;
var _local3:int = draggedSprite.x;
if (_local3 > 378){
_local2 = 1;
_local3 = (_local3 - 378);
} else {
_local3 = (_local3 + 378);
};
var _local4:Boolean;
if (_local2 == missingSide){
_local5 = leftHalf;
_local6 = placeGame.draggedObj.c.right;
if (_local2 == 1){
_local5 = rightHalf;
_local6 = placeGame.draggedObj.c.left;
};
_local4 = _local6.hitTestPoint(_local3, draggedSprite.y);
};
if (((!(_local4)) && (draggedSprite.getChildAt(0).hitTestObject(placeGame.game.c.bottomBar.slideBar2)))){
placeGame.game.addPlayData([Game.INPUT_PUT_BACK]);
} else {
placeGame.game.main.addPlayData([Game.INPUT_IMAGE_DROP, _local4]);
};
}
public function imageDrag(_arg1:MouseEvent):void{
var _local2:Sprite = Sprite(_arg1.target.parent.parent);
deActivateDrag(_local2);
var _local3:String = _local2.name;
placeGame.game.main.addPlayData([Game.INPUT_IMAGE_DRAG, _local3]);
}
public function giveHint():void{
var _local1:Obj;
var _local2:int = (Math.random() * placeGame.excludedObjs.size());
_local1 = Obj(placeGame.excludedObjs.g(_local2));
var _local3:GraphicsHalf = leftHalf;
if (placeGame.rightObjs.indexOf(_local1) != -1){
_local3 = rightHalf;
};
var _local4:Point = _local3.localToGlobal(new Point(_local1.c.x, _local1.c.y));
var _local5:HintAnimation = new HintAnimation(placeGame.game.c);
_local5.miniGameInit(_local4, _local1, placeGame.game.main.gameTimer.currentTick);
placeGame.game.c.animationLayer.addChild(_local5);
placeGame.game.main.renderer.start(_local5);
placeGame.game.c.updateRelaxHints();
}
public function startImageDrag(_arg1:String):void{
draggedSprite = Sprite(slideImages.getChildByName(_arg1));
draggedSpritePoint = draggedSprite.parent.localToGlobal(new Point(draggedSprite.x, draggedSprite.y));
draggedSpriteDepth = slideImages.getChildIndex(draggedSprite);
draggedSpriteScale = draggedSprite.scaleX;
draggedSprite.scaleX = 1;
draggedSprite.scaleY = 1;
animationLayer.addChild(draggedSprite);
draggedSprite.startDrag(true);
draggedSprite.addEventListener(MouseEvent.MOUSE_DOWN, imageDrop);
updateSlideBar();
missingSide = 0;
if (placeGame.rightObjs.indexOf(placeGame.draggedObj) != -1){
missingSide = 1;
};
}
}
}//package amazingadventures.client
Section 16
//ScoreAnimation (amazingadventures.client.ScoreAnimation)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.text.*;
public class ScoreAnimation implements Renderable {
public var started:Boolean;// = false
public var textField:TextField;// = null
public var scorePerInterval:Number;// = 0
public var score:int;// = -1
private var lastTick:int;
public var soundManager:SoundManager;// = null
public var startTick:int;// = -1
public static const INTERVAL:int = 1;
public static const TICKS:int = 30;
public function ScoreAnimation(_arg1:TextField, _arg2:int, _arg3:int, _arg4:SoundManager){
lastTick = -(ScoreAnimation.INTERVAL);
super();
this.textField = _arg1;
this.score = _arg2;
this.startTick = _arg3;
this.soundManager = _arg4;
if (_arg2 > 0){
scorePerInterval = (_arg2 / (ScoreAnimation.TICKS / ScoreAnimation.INTERVAL));
Main.renderer.start(this);
} else {
_arg1.text = "0";
};
}
public function render(_arg1:int, _arg2:Number):int{
var _local3:int;
if (((!(started)) && ((_arg1 > startTick)))){
started = true;
lastTick = _arg1;
soundManager.startSound(new OutroScoreSnd(), SoundManager.VOLUME_OUTRO_SCORE);
};
if (((started) && ((_arg1 >= (lastTick + ScoreAnimation.INTERVAL))))){
_local3 = ((lastTick - startTick) / ScoreAnimation.INTERVAL);
textField.text = ("" + Math.floor((_local3 * scorePerInterval)));
lastTick = _arg1;
};
if (_arg1 >= (startTick + ScoreAnimation.TICKS)){
textField.text = ("" + score);
return (Renderer.STOP);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 17
//ScorePop (amazingadventures.client.ScorePop)
package amazingadventures.client {
import util.*;
import flash.display.*;
import flash.text.*;
public class ScorePop extends Sprite implements Renderable {
public var fader:Fader;// = null
public var textField:TextField;
public var movement:Movement;// = null
public static var speedBonusStr:String;
public function ScorePop(){
mouseEnabled = false;
textField.mouseEnabled = false;
}
public function init(_arg1, _arg2:int, _arg3:int):void{
var _local4 = "";
if (_arg3 > 0){
_local4 = ((("\n " + ScorePop.speedBonusStr) + "\n + ") + _arg3);
};
if (_arg2 > 0){
textField.text = (("+ " + _arg2) + _local4);
} else {
textField.text = (("- " + -(_arg2)) + _local4);
};
movement = new Movement(this, _arg1, (_arg1 + 120), x, y, x, (y - 100));
fader = new Fader(this, _arg1, (_arg1 + 120), 1, 0);
}
public function render(_arg1:int, _arg2:Number):int{
if (movement != null){
if (y == movement.endY){
movement = null;
} else {
movement.update(_arg1, _arg2);
fader.update(_arg1, _arg2);
};
};
if (movement == null){
return (Renderer.STOP_REMOVE);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 18
//SoundManager (amazingadventures.client.SoundManager)
package amazingadventures.client {
import util.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class SoundManager {
public const OUTRO_DELAY:int = 400;
public const LOOP_DELAY:int = 400;
public const OUTRO_FADE_OUT:int = 1400;
private var introSoundChannel:SoundChannel;
private var introSound:Sound;
private var outroSoundTransform:SoundTransform;
private var timeWarningSoundTransform:SoundTransform;
public var outroSoundChannel:SoundChannel;
private var timeWarningSoundChannel:SoundChannel;
private var introSoundTransform:SoundTransform;
private var loopSoundChannel:SoundChannel;
private var timeWarningSound:Sound;
private var outroSound:Sound;
private var timer:Timer;
private var loopSound:Sound;
private var soundOn:Boolean;// = true
private var loopSoundTransform:SoundTransform;
private var musicOn:Boolean;// = true
public static const VOLUME_CLICK:Number = 0.7;
public static const VOLUME_OUTRO:Number = 0.7;
public static const VOLUME_PENALTY:Number = 0.7;
public static const VOLUME_LEVEL_WIN_POINTS:Number = 0.7;
public static const VOLUME_TIME_WARNING:Number = 0.7;
public static const VOLUME_MISSION_WIN_PONINTS:Number = 0.7;
public static const VOLUME_MINI_GAME_MATCH:Number = 0.7;
public static const STEREO_INTENSITY:Number = 0.7;
public static const VOLUME_INTRO:Number = 0.7;
public static const VOLUME_LOOP:Number = 0.6;
public static const VOLUME_HINT:Number = 0.7;
public static const VOLUME_NOT_FOUND:Number = 0.7;
public static const VOLUME_ROLL_OVER:Number = 0.7;
public static const VOLUME_OUTRO_SCORE:Number = 0.7;
public static const VOLUME_FOUND:Number = 0.7;
public function startIntroSound(_arg1:Event=null):void{
var _local2:Number = SoundManager.VOLUME_INTRO;
if (!musicOn){
_local2 = 0;
};
introSoundTransform = new SoundTransform(_local2);
introSound = new IntroSnd();
introSoundChannel = introSound.play(0, 0, introSoundTransform);
}
public function startLoopSound(_arg1:Event=null):void{
var _local2:Number = SoundManager.VOLUME_LOOP;
if (!musicOn){
_local2 = 0;
};
loopSoundTransform = new SoundTransform(_local2);
loopSound = new LoopSnd();
loopSoundChannel = loopSound.play(0, int.MAX_VALUE, loopSoundTransform);
}
public function getSoundOn():Boolean{
return (soundOn);
}
public function toggleSound(_arg1:MouseEvent=null):void{
soundOn = !(soundOn);
if (!soundOn){
if (timeWarningSoundChannel != null){
timeWarningSoundChannel.soundTransform = new SoundTransform(0);
};
} else {
if (timeWarningSoundChannel != null){
timeWarningSoundChannel.soundTransform = new SoundTransform(SoundManager.VOLUME_TIME_WARNING);
};
};
}
public function gameEnd():void{
if (introSoundChannel != null){
new SoundFader(introSoundChannel, OUTRO_DELAY);
};
if (loopSoundChannel != null){
new SoundFader(loopSoundChannel, OUTRO_DELAY);
};
timer = new Timer(OUTRO_DELAY, 1);
timer.addEventListener("timerComplete", startOutroSound);
timer.start();
}
public function gameStart(_arg1:Event=null):void{
if (introSoundChannel != null){
new SoundFader(introSoundChannel, LOOP_DELAY);
};
timer = new Timer(LOOP_DELAY, 1);
timer.addEventListener("timerComplete", startLoopSound);
timer.start();
}
public function getMusicOn():Boolean{
return (musicOn);
}
public function toggleMusic(_arg1:Event=null):void{
musicOn = !(musicOn);
if (musicOn){
startMusic();
} else {
stopMusic();
};
}
public function outroFadeOut():void{
if (outroSoundChannel != null){
new SoundFader(outroSoundChannel, OUTRO_FADE_OUT);
};
if (loopSoundChannel != null){
new SoundFader(loopSoundChannel, OUTRO_FADE_OUT);
};
}
protected function playSound(_arg1:Sound, _arg2:Number, _arg3:int=0):void{
var _local4:SoundTransform = new SoundTransform(_arg2);
var _local5:Sound = _arg1;
var _local6:SoundChannel = _local5.play(0, _arg3, _local4);
}
public function stopMusic():void{
if (loopSoundChannel != null){
loopSoundChannel.soundTransform = new SoundTransform(0);
};
if (introSoundChannel != null){
introSoundChannel.soundTransform = new SoundTransform(0);
};
if (outroSoundChannel != null){
outroSoundChannel.soundTransform = new SoundTransform(0);
};
}
public function startOutroSound(_arg1:Event=null):void{
var _local2:Number = SoundManager.VOLUME_OUTRO;
if (!musicOn){
_local2 = 0;
};
outroSoundTransform = new SoundTransform(_local2);
outroSound = new IntroSnd();
outroSoundChannel = outroSound.play(0, 0, outroSoundTransform);
}
public function startSound(_arg1:Sound, _arg2:Number, _arg3:int=0):void{
if (soundOn){
playSound(_arg1, _arg2, _arg3);
};
}
public function startTimeWarning():void{
var _local1:Number = SoundManager.VOLUME_TIME_WARNING;
if (!soundOn){
_local1 = 0;
};
timeWarningSoundTransform = new SoundTransform(_local1);
timeWarningSound = new TimeWarningSnd();
timeWarningSoundChannel = timeWarningSound.play(0, 0, timeWarningSoundTransform);
}
public function startMusic():void{
if (musicOn){
if (loopSoundChannel != null){
loopSoundChannel.soundTransform = new SoundTransform(SoundManager.VOLUME_LOOP);
};
if (introSoundChannel != null){
introSoundChannel.soundTransform = new SoundTransform(SoundManager.VOLUME_INTRO);
};
if (outroSoundChannel != null){
outroSoundChannel.soundTransform = new SoundTransform(SoundManager.VOLUME_OUTRO);
};
};
}
}
}//package amazingadventures.client
Section 19
//SpotFoundAnimation (amazingadventures.client.SpotFoundAnimation)
package amazingadventures.client {
import util.*;
public class SpotFoundAnimation implements Renderable {
var move:Movement;// = null
var image:Image;
var fade:Fader;// = null
public function SpotFoundAnimation(_arg1:Image, _arg2:int){
this.image = _arg1;
move = new Movement(_arg1, _arg2, (_arg2 + 60), _arg1.x, _arg1.y, 755, 0);
fade = new Fader(_arg1, _arg2, (_arg2 + 60), 1, 0);
}
public function render(_arg1:int, _arg2:Number):int{
if (move != null){
move.update(_arg1, _arg2);
fade.update(_arg1, _arg2);
if (_arg1 >= move.endTick){
move = null;
fade = null;
};
} else {
image.parent.removeChild(image);
return (Renderer.STOP);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 20
//SpotGameC (amazingadventures.client.SpotGameC)
package amazingadventures.client {
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class SpotGameC {
public var target:Target;// = null
public var spotGame:SpotGame;// = null
public var gameSprite:Sprite;// = null
public var leftHalf:GraphicsHalf;// = null
var leftImages:Array;
public var imagesToHitLeft:Array;// = null
public var animationLayer:Sprite;// = null
var rightImages:Array;
public var rightHalf:GraphicsHalf;// = null
public var imagesToHitRight:Array;// = null
public function SpotGameC(_arg1:SpotGame){
var _local2:int;
var _local6:Obj;
var _local7:Obj;
var _local8:Obj;
super();
this.spotGame = _arg1;
this.gameSprite = _arg1.game.c.gameSprite;
this.animationLayer = _arg1.game.c.animationLayer;
leftImages = new Array();
rightImages = new Array();
_local2 = 0;
while (_local2 < _arg1.objs.size()) {
_local6 = Obj(_arg1.objs.g(_local2));
_local6.c.spotInit();
if (_arg1.leftExcludedObjs.indexOf(_local6) == -1){
leftImages.push(_local6.c.left);
};
if (_arg1.rightExcludedObjs.indexOf(_local6) == -1){
rightImages.push(_local6.c.right);
};
_local2++;
};
imagesToHitRight = new Array();
_local2 = 0;
while (_local2 < _arg1.leftExcludedObjs.size()) {
_local7 = Obj(_arg1.leftExcludedObjs.g(_local2));
imagesToHitRight.push(_local7.c.right);
_local2++;
};
imagesToHitLeft = new Array();
_local2 = 0;
while (_local2 < _arg1.rightExcludedObjs.size()) {
_local8 = Obj(_arg1.rightExcludedObjs.g(_local2));
imagesToHitLeft.push(_local8.c.left);
_local2++;
};
var _local3:XMLList = Main.gameDataXml.images;
var _local4:String = _arg1.game.getPlaceName();
leftHalf = new GraphicsHalf(_local3, _local4, leftImages);
var _local5:int = (_arg1.sideOfScene * -378);
leftHalf.x = (_local5 - 2);
gameSprite.addChild(leftHalf);
rightHalf = new GraphicsHalf(_local3, _local4, rightImages);
rightHalf.x = ((_local5 + 378) + 1);
rightHalf.theMask.x = 378;
gameSprite.addChild(rightHalf);
_arg1.game.c.middleBorder.visible = true;
if (!_arg1.game.hintUsed){
_arg1.game.c.hintBh.func = hintClicked;
_arg1.game.c.hintBh.active = true;
};
_arg1.game.c.updateItemsLeft(_arg1.excludedObjs.size());
if (_arg1.game.main.relaxMode){
_arg1.game.c.updateRelaxHints();
};
}
public function cleanUp():void{
gameSprite.removeEventListener(MouseEvent.CLICK, click);
target.cleanUp();
}
public function click(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local6:Image;
if ((((_arg1.stageX > 0)) && ((_arg1.stageX < 756)))){
if (_arg1.stageX > 378){
_local2 = (_arg1.stageX - 378);
_local3 = _arg1.stageX;
} else {
_local2 = _arg1.stageX;
_local3 = (_arg1.stageX + 378);
};
};
var _local5:Boolean;
var _local7:Image;
var _local8 = -1;
_local4 = (leftImages.length - 1);
while (_local4 >= 0) {
_local6 = Image(leftImages[_local4]);
if (((!((getExcludedObjById(_local6.name) == null))) && (_local6.testHit(_local2, _arg1.stageY)))){
_local7 = _local6;
_local8 = parseInt(_local6.name.substr(3));
break;
};
_local4--;
};
var _local9:Image;
var _local10 = -1;
_local4 = (rightImages.length - 1);
while (_local4 >= 0) {
_local6 = Image(rightImages[_local4]);
if (((!((getExcludedObjById(_local6.name) == null))) && (_local6.testHit(_local3, _arg1.stageY)))){
_local9 = _local6;
_local10 = parseInt(_local6.name.substr(3));
break;
};
_local4--;
};
_local6 = null;
if ((((_local8 > -1)) && ((_local8 > _local10)))){
_local6 = _local7;
} else {
if (_local10 > -1){
_local6 = _local9;
};
};
var _local11 = "background";
if (_local6 != null){
_local11 = _local6.name;
};
spotGame.game.main.addPlayData([Game.INPUT_SPOT_CLICK, _local11, int(_arg1.stageX), int(_arg1.stageY)]);
}
public function getExcludedObjById(_arg1:String):Obj{
var _local3:Obj;
var _local2:int;
while (_local2 < spotGame.excludedObjs.size()) {
_local3 = Obj(spotGame.excludedObjs.g(_local2));
if (_arg1 == _local3.id){
return (_local3);
};
_local2++;
};
return (null);
}
public function init():void{
target = new Target();
gameSprite.addChild(target);
target.init();
gameSprite.addEventListener(MouseEvent.CLICK, click);
}
public function hintClicked(_arg1:Event=null):void{
spotGame.game.main.addPlayData([Game.INPUT_HINT]);
spotGame.game.c.hintBh.active = false;
Main.main.soundManager.startSound(new HintSnd(), SoundManager.VOLUME_HINT);
}
public function animateSuccess(_arg1:int, _arg2:Obj, _arg3:int, _arg4:int, _arg5:int):void{
var _local11:int;
spotGame.game.c.updateScoreTf();
spotGame.game.c.updateItemsLeft(spotGame.excludedObjs.size());
var _local6:GraphicsHalf = leftHalf;
var _local7:Image = _arg2.c.left;
if (_arg3 == 1){
_local6 = rightHalf;
_local7 = _arg2.c.right;
};
var _local8:int = Math.floor((_local7.width / 2));
var _local9:int = Math.floor((_local7.height / 2));
var _local10:SuccessAnimation = new SuccessAnimation();
animationLayer.addChild(_local10);
_local10.x = (_local7.x + _local8);
_local10.y = (_local7.y + _local9);
_local10.init(spotGame.game.main.gameTimer.currentTick);
spotGame.game.main.renderer.start(_local10);
if (_local7.x > 378){
_local11 = (_local7.x - 378);
} else {
_local11 = (_local7.x + 378);
};
var _local12:SuccessAnimation = new SuccessAnimation();
animationLayer.addChild(_local12);
_local12.x = (_local11 + _local8);
_local12.y = (_local7.y + _local9);
_local12.init(spotGame.game.main.gameTimer.currentTick);
spotGame.game.main.renderer.start(_local12);
var _local13:Point = _local6.localToGlobal(new Point(_local7.x, _local7.y));
_local7.x = _local13.x;
_local7.y = _local13.y;
animationLayer.addChild(_local7);
var _local14:SpotFoundAnimation = new SpotFoundAnimation(_local7, _arg4);
spotGame.game.main.renderer.start(_local14);
var _local15:ScorePop = new ScorePop();
_local15.x = (_local7.x + _local8);
var _local16:int = (755 - 150);
if (_local15.x > _local16){
_local15.x = _local16;
};
_local15.y = (_local7.y + _local9);
animationLayer.addChild(_local15);
_local15.init(_arg4, _arg1, _arg5);
spotGame.game.main.renderer.start(_local15);
Main.main.soundManager.startSound(new MiniGameMatchSnd(), SoundManager.VOLUME_MINI_GAME_MATCH);
}
public function animateFailure(_arg1:int, _arg2:int, _arg3:int):void{
var _local5:ScorePop;
var _local6:int;
spotGame.game.c.updateScoreTf();
var _local4:FailAnimation = new FailAnimation(_arg1, _arg2, spotGame.game.main.gameTimer.currentTick);
animationLayer.addChild(_local4);
spotGame.game.main.renderer.start(_local4);
if (_arg3 < 0){
_local5 = new ScorePop();
animationLayer.addChild(_local5);
_local6 = (755 - 50);
if (_arg1 > _local6){
_local5.x = _local6;
} else {
_local5.x = _arg1;
};
_local5.y = _arg2;
_local5.init(spotGame.game.main.gameTimer.currentTick, _arg3, 0);
spotGame.game.main.renderer.start(_local5);
};
Main.main.soundManager.startSound(new PenaltySnd(), SoundManager.VOLUME_PENALTY);
}
public function giveHint():void{
var _local1:Obj;
var _local2:int = (Math.random() * spotGame.excludedObjs.size());
_local1 = Obj(spotGame.excludedObjs.g(_local2));
var _local3:GraphicsHalf = leftHalf;
if (spotGame.rightExcludedObjs.indexOf(_local1) != -1){
_local3 = rightHalf;
};
var _local4:Point = _local3.localToGlobal(new Point(_local1.c.x, _local1.c.y));
var _local5:HintAnimation = new HintAnimation(spotGame.game.c);
_local5.miniGameInit(_local4, _local1, spotGame.game.main.gameTimer.currentTick);
spotGame.game.c.animationLayer.addChild(_local5);
spotGame.game.main.renderer.start(_local5);
spotGame.game.c.updateRelaxHints();
}
}
}//package amazingadventures.client
Section 21
//SpyGameC (amazingadventures.client.SpyGameC)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
public class SpyGameC {
public var foreground:Image;// = null
public var spyGame:SpyGame;// = null
public var slideBarStartIndex:int;// = 0
public var gameSprite:Sprite;// = null
public var slideBar:SlideBar;// = null
public var animationLayer:Sprite;// = null
public var background:Image;// = null
public function SpyGameC(_arg1:SpyGame){
var imageXml:XMLList;
var bgName:String;
var bgXml:XMLList;
var fgName:String;
var fgXml:XMLList;
var spyGame = _arg1;
super();
this.spyGame = spyGame;
this.gameSprite = spyGame.game.c.gameSprite;
this.animationLayer = spyGame.game.c.animationLayer;
spyGame.game.c.updateItemsLeft(Game.NO_THINGS_TO_FIND);
spyGame.game.c.topBar.scoreTf.text = ("" + 0);
imageXml = Main.gameDataXml.images;
bgName = (("sc_" + spyGame.game.getPlaceName()) + "_background");
bgXml = imageXml.image.(String(@id).indexOf(bgName) != -1);
background = new Image(bgXml);
background.name = "background";
background.x = parseInt(bgXml.@x);
background.y = parseInt(bgXml.@y);
gameSprite.addChild(background);
prepareObjs();
fgName = (("sc_" + spyGame.game.getPlaceName()) + "_foreground");
fgXml = imageXml.image.(String(@id).indexOf(fgName) != -1);
foreground = new Image(fgXml);
foreground.x = parseInt(fgXml.@x);
foreground.y = parseInt(fgXml.@y);
foreground.mouseDisable();
GameC.addChildAtByFrame(foreground, gameSprite);
prepareTextItems();
spyGame.game.c.hintBh.func = hintClicked;
gameSprite.addEventListener(MouseEvent.CLICK, gameClicked);
if (spyGame.game.main.relaxMode){
spyGame.game.c.updateRelaxHints();
};
}
public function wrongThing(_arg1:int, _arg2:int, _arg3:int):void{
var _local5:ScorePop;
var _local6:int;
spyGame.game.c.updateScoreTf();
var _local4:FailAnimation = new FailAnimation(_arg1, _arg2, spyGame.game.main.gameTimer.currentTick);
animationLayer.addChild(_local4);
spyGame.game.main.renderer.start(_local4);
if (_arg3 < 0){
_local5 = new ScorePop();
animationLayer.addChild(_local5);
_local6 = (755 - 50);
if (_arg1 > _local6){
_local5.x = _local6;
} else {
_local5.x = _arg1;
};
_local5.y = _arg2;
_local5.init(spyGame.game.main.gameTimer.currentTick, _arg3, 0);
spyGame.game.main.renderer.start(_local5);
};
Main.main.soundManager.startSound(new PenaltySnd(), SoundManager.VOLUME_PENALTY);
}
public function prepareObjs():void{
var _local3:Obj;
var _local1:Stack = spyGame.game.objs;
var _local2:int;
while (_local2 < _local1.size()) {
_local3 = Obj(_local1.g(_local2));
_local3.c.spyInit(gameSprite);
_local2++;
};
}
public function prepareTextItems():void{
var _local7:int;
var _local8:String;
var _local9:TextItem;
var _local10:TextFormat;
var _local11:int;
var _local12:int;
var _local13:int;
slideBar = spyGame.game.c.bottomBar.slideBar;
slideBarStartIndex = slideBar.numChildren;
var _local1 = 28;
var _local2 = 14;
var _local3 = 109;
var _local4 = 133;
var _local5:XMLList = Main.gameDataXml.strings.string;
var _local6:int = _local5.length();
if (_local6 != Game.NO_THINGS_TO_FIND){
spyGame.game.addPlayData([Game.ERROR_MESSAGE, ((("Recieved_" + _local6) + "_words._Should_be_") + Game.NO_THINGS_TO_FIND)]);
spyGame.game.main.gameEnd(0, Game.ERROR);
} else {
_local7 = 0;
while (_local7 < _local5.length()) {
_local8 = String(_local5[_local7]);
_local9 = new TextItem();
_local10 = new TextFormat();
_local10.letterSpacing = 1;
_local10.size = 11;
_local9.textField.defaultTextFormat = _local10;
_local9.textField.text = _local8;
_local9.line.gotoAndStop(0);
slideBar.addChild(_local9);
while ((((_local9.textField.textWidth > (_local9.textField.width - 10))) && ((int(_local10.size) > 8)))) {
_local10.size = (int(_local10.size) - 1);
_local9.textField.setTextFormat(_local10);
_local9.textField.y = (_local9.textField.y + 0.5);
};
_local11 = 0;
_local12 = _local7;
_local13 = (_local5.length() / 2);
if (_local7 >= _local13){
_local11 = 1;
_local12 = (_local7 - _local13);
};
_local9.x = (_local3 + (_local12 * _local4));
_local9.y = (_local1 + (_local11 * _local2));
_local7++;
};
};
}
public function deActivate():void{
gameSprite.removeEventListener(MouseEvent.CLICK, gameClicked);
spyGame.game.c.hintBh.active = false;
}
public function gameClicked(_arg1:MouseEvent):void{
var _local5:Obj;
var _local2 = -1;
var _local3:Obj;
var _local4:int;
while (_local4 < spyGame.thingsToFind.size()) {
_local5 = Obj(spyGame.thingsToFind.g(_local4));
if (_local5.c.click(_arg1.stageX, _arg1.stageY)){
if (_local5.c.left.frame > _local2){
_local2 = _local5.c.left.frame;
_local3 = _local5;
};
};
_local4++;
};
if (_local3 != null){
_local3.c.hit(_arg1.stageX, _arg1.stageY);
} else {
spyGame.game.main.addPlayData([Game.INPUT_BG_CLICKED, Math.floor(_arg1.stageX), Math.floor(_arg1.stageY)]);
};
}
public function test(_arg1:Event):void{
}
public function hintClicked(_arg1:Event=null):void{
spyGame.game.main.addPlayData([Game.INPUT_HINT]);
spyGame.game.c.hintBh.active = false;
Main.main.soundManager.startSound(new HintSnd(), SoundManager.VOLUME_HINT);
}
public function removeGraphics():void{
var _local2:ObjC;
gameSprite.removeChild(background);
gameSprite.removeChild(foreground);
var _local1:int;
while (_local1 < spyGame.game.objs.size()) {
_local2 = Obj(spyGame.game.objs.g(_local1)).c;
_local2.spyCleanUp();
_local1++;
};
while (slideBar.numChildren > 1) {
slideBar.removeChildAt(1);
};
slideBar.visible = false;
slideBar = null;
gameSprite = null;
animationLayer = null;
}
public function thingFound(_arg1:Obj, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Image = _arg1.c.left;
gameSprite.removeChild(_local5);
var _local6:TextItem = TextItem(slideBar.getChildAt((slideBarStartIndex + _arg2)));
var _local7:Point = slideBar.localToGlobal(new Point(_local6.x, _local6.y));
var _local8:FoundAnimation = new FoundAnimation(animationLayer, _local5, _local6, _local7.x, _local7.y, spyGame.game.main.gameTimer.currentTick, _arg3, _arg4);
spyGame.game.main.renderer.start(_local8);
Main.main.soundManager.startSound(new FoundSnd(), SoundManager.VOLUME_FOUND);
spyGame.game.c.updateScoreTf();
spyGame.game.c.updateItemsLeft((spyGame.thingsToFind.size() - spyGame.foundThings.size()));
}
public function giveHint():void{
var _local1:Obj;
var _local2:Array = new Array();
var _local3:int;
while (_local3 < spyGame.thingsToFind.size()) {
_local1 = Obj(spyGame.thingsToFind.g(_local3));
if (spyGame.foundThings.indexOf(_local1) == -1){
_local2.push(_local1);
};
_local3++;
};
var _local4:int = (Math.random() * _local2.length);
_local1 = Obj(_local2[_local4]);
var _local5:HintAnimation = new HintAnimation(spyGame.game.c);
_local5.spyInit(_local1, spyGame.game.main.gameTimer.currentTick);
spyGame.game.c.animationLayer.addChild(_local5);
spyGame.game.main.renderer.start(_local5);
spyGame.game.c.updateRelaxHints();
}
public function checkForShortGameEnd():void{
if (((spyGame.game.c.shortMode) && ((spyGame.foundThings.size() >= 8)))){
spyGame.game.gameEnd(spyGame.game.main.gameTimer.currentTick, Game.SHORT_GAME_END);
};
}
}
}//package amazingadventures.client
Section 22
//SuccessAnimation (amazingadventures.client.SuccessAnimation)
package amazingadventures.client {
import util.*;
import flash.display.*;
public class SuccessAnimation extends MovieClip implements Renderable {
public var framePlayer:FramePlayer;// = null
public function SuccessAnimation(){
mouseEnabled = false;
}
public function init(_arg1:int):void{
framePlayer = new FramePlayer(this, _arg1, 120, 0);
}
public function render(_arg1:int, _arg2:Number):int{
if (framePlayer != null){
if (_arg1 > framePlayer.endTick){
framePlayer = null;
} else {
framePlayer.update(_arg1, _arg2);
};
};
if (framePlayer == null){
return (Renderer.STOP_REMOVE);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 23
//Target (amazingadventures.client.Target)
package amazingadventures.client {
import flash.events.*;
import flash.display.*;
public class Target extends Sprite {
public function init():void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, update);
}
public function update(_arg1:MouseEvent):void{
var _local3:Number;
var _local2:Number = stage.mouseX;
if (_local2 > 378){
_local3 = (_local2 - 378);
} else {
_local3 = (_local2 + 378);
};
if (_local3 < 0){
_local3 = 0;
} else {
if (_local3 > 755){
_local3 = 755;
};
};
x = _local3;
y = stage.mouseY;
_arg1.updateAfterEvent();
}
public function cleanUp():void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, update);
}
}
}//package amazingadventures.client
Section 24
//TorchAnimation (amazingadventures.client.TorchAnimation)
package amazingadventures.client {
import util.*;
import amazingadventures.*;
import flash.display.*;
public class TorchAnimation extends MovieClip implements Renderable {
public var framePlayer:FramePlayer;// = null
public function TorchAnimation(){
Main.renderer.start(this);
}
public function render(_arg1:int, _arg2:Number):int{
if (framePlayer == null){
framePlayer = new FramePlayer(this, _arg1, 60, int.MAX_VALUE);
};
framePlayer.update(_arg1, _arg2);
if (parent.parent.parent == null){
return (Renderer.STOP);
};
return (Renderer.CONTINUE);
}
}
}//package amazingadventures.client
Section 25
//Game (amazingadventures.Game)
package amazingadventures {
import util.*;
import flash.events.*;
import amazingadventures.client.*;
public class Game {
private var playData:Stack;// = null
public var state:int;// = 0
public var spotGame:SpotGame;// = null
public var placeGame:PlaceGame;// = null
public var rand:Random;// = null
public var placeNr:int;// = -1
public var countDownTicks:int;// = 0
public var totalScore:int;// = 0
public var startMiniGameTick:int;// = -1
public var main:Main;// = null
public var showEndDialogTick:int;// = -1
public var hintScore:int;// = 0
public var spyGame:SpyGame;// = null
public var timeBonus:int;// = 0
public var showDialogTick:int;// = -1
public var objs:Stack;// = null
public var hintUsed:Boolean;// = false
public var penalties:int;// = 0
public var miniGame:Object;// = null
public var c:GameC;// = null
public var seed:int;// = -1
public var endReason;// = -1
public static const GAME_OVER:int = 6;
public static const SPOT_START_DIALOG:int = 4;
public static const TIME_RAN_OUT:int = 0;
public static const INPUT_START_NEXT:int = 8;
public static const TICKS_PER_SECOND:int = 60;
public static const END_REASONS:Array = ["timeRanOut", "userChoseExit", "completed", "error", "shortGameEnd", "relaxLastMiss", "relaxComplete", "loadSwfFail"];
public static const SPOT_GAME:int = 5;
public static const ERROR_MESSAGE:int = 5;
public static const INPUT_EXIT:int = 0;
public static const STATE_STRINGS:Array = ["not started", "spy game", "place start dialog", "place game", "spot start dialog", "spot game", "game over"];
public static const USER_CHOSE_EXIT:int = 1;
public static const CHEAT_TIMER_ALERT:int = 3;
public static const LOAD_SWF_FAIL:int = 7;
public static const PRACTICE_PLACES:Array = [1, 7, 10, 13, 24];
public static const THING_CLICKED:int = 4;
public static const INPUT_SPOT_CLICK:int = 11;
public static const COMPLETED:int = 2;
public static const LAST_TICK:int = 2;
public static const SPY_GAME:int = 1;
public static const NOT_SET:int = -1;
public static const RELAX_COMPLETE:int = 6;
public static const COUNTDOWN_SECONDS:int = 360;
public static const INPUT_TOGGLE_SOUND:int = 13;
public static const INPUT_PUT_BACK:int = 12;
public static const PLACE_START_DIALOG:int = 2;
public static const INPUT_IMAGE_DROP:int = 10;
public static const NO_THINGS_TO_FIND:int = 10;
public static const INPUT_BG_CLICKED:int = 7;
public static const DELUXE_PRACTICE_PLACES:Array = [0, 7, 11, 12, 15];
public static const PLACE_GAME:int = 3;
public static const INPUT_STRINGS:Array = ["exit", "firstTick", "lastTick", "cheatTimerAlert", "thingClicked", "errorMessage", "hint", "bgClicked", "startPlace", "startDrag", "dropImage", "spotClick", "putBack", "toggleSound", "toggleMusic"];
public static const INPUT_TOGGLE_MUSIC:int = 14;
public static const PLACES:Array = ["machupicchu", "greece", "amazon", "angkorwat", "ayersrock", "barrierreef", "beachhut", "castle", "greatwall", "hawaii", "hermitage", "igauzufalls", "igloo", "london", "morocco", "petra", "port", "rockymnt", "serengeti", "shipwreck", "speakeasy", "statueofliberty", "tajmahal", "temple", "train"];
public static const DELUXE_PLACES:Array = ["airplane", "archtent", "bar", "bedroom", "boat", "cavepainting", "courtyard", "digs", "excavation", "garden", "goldmask", "market", "mine", "pyramid", "shipwreck", "stable", "temple", "tent", "throne", "tomb", "treasure", "underwater"];
public static const NOT_STARTED:int = 0;
public static const MINIGAME_DIALOG_TICKS:int = 600;
public static const TIME_WARNING_TICKS:int = 168;
public static const MINIGAME_DIALOG_SECONDS:int = 10;
public static const UNUSED_HINT:int = 500;
public static const ERROR:int = 3;
public static const INPUT_IMAGE_DRAG:int = 9;
public static const COUNTDOWN_TICKS:int = 21600;
public static const MAX_TIME_BONUS:int = 2500;
public static const SHORT_GAME_END:int = 4;
public static const RELAX_LAST_MISS:int = 5;
public static const FIRST_TICK:int = 1;
public static const INPUT_HINT:int = 6;
public function Game(_arg1:Main, _arg2:int){
var _local3:int;
super();
this.main = _arg1;
this.seed = _arg2;
_arg1.log((("[seed " + _arg2) + "]"));
rand = new Random(_arg2);
if (!_arg1.relaxMode){
if (Main.IS_DELUXE){
_local3 = rand.nextInt(Game.DELUXE_PLACES.length);
} else {
_local3 = rand.nextInt(Game.PLACES.length);
};
};
if (Main.GAME_TYPE == Main.FIXED){
placeNr = _arg1.fixedPlaceNr;
} else {
placeNr = int(Main.gameDataXml.@placenr);
};
_arg1.log(("place: " + getPlaceName()));
countDownTicks = Game.COUNTDOWN_TICKS;
c = new GameC(this);
makeObjects(Main.gameDataXml.images);
playData = new Stack();
spyGame = new SpyGame(this);
}
public function destroy():void{
c.deActivate();
if (placeGame != null){
placeGame.c.cleanUp();
};
if (spotGame != null){
spotGame.c.cleanUp();
};
}
public function getPlaceName():String{
if (Main.IS_DELUXE){
return (String(Game.DELUXE_PLACES[placeNr]));
};
return (String(Game.PLACES[placeNr]));
}
public function start():void{
state = Game.SPY_GAME;
c.start();
}
protected function inputExit(_arg1:int):void{
gameEnd(_arg1, Game.USER_CHOSE_EXIT);
}
public function gameEnd(_arg1:int, _arg2:int):void{
var _local5:int;
var _local6:int;
var _local7:Number;
this.endReason = _arg2;
c.deActivate();
var _local3:String = String(Game.END_REASONS[_arg2]);
main.log(("gameEnd, endReason: " + _local3));
state = Game.GAME_OVER;
var _local4 = 120;
if ((((_arg2 == Game.USER_CHOSE_EXIT)) || ((_arg2 == Game.TIME_RAN_OUT)))){
_local4 = 5;
};
showEndDialogTick = (main.gameTimer.currentTick + _local4);
if (main.relaxMode){
_local5 = spyGame.score;
if (miniGame != null){
if ((miniGame is PlaceGame)){
_local5 = (_local5 + placeGame.score);
} else {
_local5 = (_local5 + spotGame.score);
};
};
main.relaxScores[main.relaxGameNr] = _local5;
totalScore = 0;
_local6 = 0;
while (_local6 < main.relaxScores.length) {
totalScore = (totalScore + int(main.relaxScores[_local6]));
_local6++;
};
if (_arg2 != Game.USER_CHOSE_EXIT){
if (main.relaxHints < 0){
main.relaxHints = 0;
};
main.relaxUnusedHintsScore = (main.relaxHints * Game.UNUSED_HINT);
totalScore = (totalScore + main.relaxUnusedHintsScore);
};
main.gameEnd(totalScore, _arg2);
} else {
if (_arg2 == Game.COMPLETED){
if (!hintUsed){
hintScore = Game.UNUSED_HINT;
};
_local7 = (countDownTicks / Game.COUNTDOWN_TICKS);
timeBonus = Math.floor((Game.MAX_TIME_BONUS * _local7));
};
totalScore = ((((spyGame.score + spyGame.speedBonus) + penalties) + hintScore) + timeBonus);
main.log(("SpyGame score " + spyGame.score));
main.log(("SpyGame speedBonus " + spyGame.speedBonus));
if (miniGame != null){
if ((miniGame is PlaceGame)){
totalScore = (totalScore + (placeGame.score + placeGame.speedBonus));
main.log(("PlaceGame score " + placeGame.score));
main.log(("PlaceGame speedBonus " + placeGame.speedBonus));
} else {
totalScore = (totalScore + (spotGame.score + spotGame.speedBonus));
main.log(("spotGame score " + spotGame.score));
main.log(("spotGame speedBonus " + spotGame.speedBonus));
};
};
main.log(("hintScore " + hintScore));
main.log(("timeBonus " + timeBonus));
main.log(("penalties " + penalties));
main.log(("totalScore " + totalScore));
main.addPlayData([Game.LAST_TICK]);
main.gameEnd(totalScore, _arg2);
};
}
public function spyGameEnded(_arg1:MouseEvent=null):void{
var _local2:int = rand.nextInt(2);
if (_local2 == 0){
state = Game.PLACE_START_DIALOG;
main.log("mini game: place");
} else {
state = Game.SPOT_START_DIALOG;
main.log("mini game: spot");
};
var _local3 = 120;
if (_arg1 != null){
_local3 = 5;
};
showDialogTick = (main.gameTimer.currentTick + _local3);
}
public function getSpeedBonus(_arg1:int, _arg2:int, _arg3:int, _arg4:int):int{
var _local5:int;
var _local6:int;
if (_arg4 != -1){
_local5 = (_arg3 - _arg4);
_local6 = (_arg1 - Math.floor((_local5 / _arg2)));
if (_local6 < 0){
_local6 = 0;
};
return (_local6);
//unresolved jump
};
return (0);
}
public function getCurrentScore():int{
var _local1:int = getScoreBeforePenalties();
_local1 = (_local1 + penalties);
if (_local1 < 0){
_local1 = 0;
};
return (_local1);
}
protected function executePlayData(_arg1:int):void{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:String;
var _local6:String;
var _local7:int;
var _local8:Boolean;
var _local9:String;
while (playData.size() > 0) {
_local2 = playData.remove(0);
_local3 = int(_local2[0]);
_local4 = int(_local2[1]);
_local5 = String(Game.INPUT_STRINGS[_local3]);
_local6 = ((_local5 + " ") + _local4);
_local7 = 2;
while (_local7 < _local2.length) {
var _temp1 = _local7;
_local7 = (_local7 + 1);
_local9 = _local2[_temp1];
_local6 = (_local6 + (" " + _local9));
};
main.log((("[" + _local6) + "]"));
_local8 = false;
if (state == Game.SPY_GAME){
_local8 = spyGame.executeInput(_local2, _local3, _local4, _arg1);
} else {
if (state == Game.PLACE_GAME){
_local8 = placeGame.executeInput(_local2, _local3, _local4, _arg1);
} else {
if (state == Game.SPOT_GAME){
_local8 = spotGame.executeInput(_local2, _local3, _local4, _arg1);
} else {
if ((((state == Game.PLACE_START_DIALOG)) || ((state == Game.SPOT_START_DIALOG)))){
switch (_local3){
case Game.THING_CLICKED:
case Game.INPUT_HINT:
case Game.INPUT_BG_CLICKED:
_local8 = true;
break;
};
};
};
};
};
if (!_local8){
switch (_local3){
case Game.INPUT_EXIT:
inputExit(_arg1);
break;
case Game.INPUT_START_NEXT:
startNext();
break;
case Game.LAST_TICK:
break;
case Game.CHEAT_TIMER_ALERT:
break;
case Game.FIRST_TICK:
break;
case Game.INPUT_TOGGLE_MUSIC:
break;
case Game.INPUT_TOGGLE_SOUND:
break;
default:
main.log(("**** Error in game.tick(). Invalid inputType: " + _local3));
};
if (((!((_local4 == _arg1))) && (!((_local3 == Game.LAST_TICK))))){
main.log(((("**** Warning, bad sync! tickToExecute " + _local4) + " currentTick ") + _arg1));
};
};
};
}
public function tick(_arg1:int):void{
executePlayData(_arg1);
update(_arg1);
}
public function relaxWrongObj(_arg1:int):void{
main.relaxHints--;
if (main.relaxHints < 0){
gameEnd(_arg1, Game.RELAX_LAST_MISS);
};
}
public function getScoreBeforePenalties():int{
var _local1:int = (spyGame.score + spyGame.speedBonus);
if ((((state == Game.PLACE_GAME)) || ((((state == Game.GAME_OVER)) && ((miniGame is PlaceGame)))))){
_local1 = (_local1 + placeGame.score);
_local1 = (_local1 + placeGame.speedBonus);
} else {
if ((((state == Game.SPOT_GAME)) || ((((state == Game.GAME_OVER)) && ((miniGame is SpotGame)))))){
_local1 = (_local1 + spotGame.score);
_local1 = (_local1 + spotGame.speedBonus);
};
};
return (_local1);
}
public function addPlayData(_arg1:Array):void{
playData.push(_arg1);
}
public function getObj(_arg1:int):Obj{
var _local3:Obj;
var _local2:int;
while (_local2 < objs.size()) {
_local3 = Obj(objs.g(_local2));
if (_local3.nr == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
protected function update(_arg1:int):void{
if (!main.relaxMode){
countDown(_arg1);
};
if (_arg1 == showDialogTick){
if (c.shortMode){
} else {
startMiniGameTick = (_arg1 + Game.MINIGAME_DIALOG_TICKS);
if (state == Game.PLACE_START_DIALOG){
c.showExtraGameDialog();
spyGame.cleanUp();
placeGame = new PlaceGame(this);
miniGame = placeGame;
} else {
if (state == Game.SPOT_START_DIALOG){
c.showExtraGameDialog();
spyGame.cleanUp();
spotGame = new SpotGame(this);
miniGame = spotGame;
};
};
};
} else {
if (_arg1 == showEndDialogTick){
if (main.relaxMode){
if ((((((endReason == Game.RELAX_COMPLETE)) || ((endReason == Game.RELAX_LAST_MISS)))) || ((endReason == Game.USER_CHOSE_EXIT)))){
main.showOutro();
} else {
main.showMiddleGameDialog();
};
} else {
main.showOutro();
};
};
};
if (_arg1 == startMiniGameTick){
startNext();
};
}
private function makeObjects(_arg1:XMLList):void{
var objNodes:XMLList;
var o:int;
var objXml:XMLList;
var document = _arg1;
objs = new Stack();
objNodes = document.image.(String(@id).indexOf("obj") != -1);
o = 0;
while (o < objNodes.length()) {
objXml = XMLList(objNodes[o]);
objs.push(new Obj(this, objXml));
o = (o + 1);
};
}
protected function countDown(_arg1:int):void{
if ((((((state == Game.SPY_GAME)) || ((state == Game.PLACE_GAME)))) || ((state == Game.SPOT_GAME)))){
countDownTicks--;
};
if (state != Game.GAME_OVER){
if (countDownTicks <= 0){
gameEnd(_arg1, Game.TIME_RAN_OUT);
};
if (countDownTicks == (Game.TIME_WARNING_TICKS * 4)){
c.timeWarning(true);
} else {
if (countDownTicks == (Game.TIME_WARNING_TICKS * 3)){
c.timeWarning(false);
} else {
if (countDownTicks == (Game.TIME_WARNING_TICKS * 2)){
c.timeWarning(false);
} else {
if (countDownTicks == (Game.TIME_WARNING_TICKS * 1)){
c.timeWarning(false);
};
};
};
};
};
}
public function subtractPenalty(_arg1):int{
var _local2:int = getCurrentScore();
penalties = (penalties + _arg1);
var _local3:int = (getCurrentScore() - _local2);
var _local4:int = getScoreBeforePenalties();
if ((_local4 + penalties) < 0){
penalties = -(_local4);
};
return (_local3);
}
public function startNext():void{
c.startNext();
if (state == Game.PLACE_START_DIALOG){
state = Game.PLACE_GAME;
} else {
state = Game.SPOT_GAME;
spotGame.c.init();
};
startMiniGameTick = 0;
}
}
}//package amazingadventures
Section 26
//Main (amazingadventures.Main)
package amazingadventures {
import util.*;
import flash.events.*;
import flash.display.*;
import amazingadventures.client.*;
import flash.text.*;
import flash.net.*;
import flash.external.*;
public class Main extends Sprite {
public var relaxTextXml:XMLList;// = null
public var demoSeed:int;// = -1
public var relaxGameNr:int;// = 0
public var outro:Outro;// = null
public var demoPlaceLoader:URLLoader;// = null
public var relaxHints:int;// = 3
public var fixedPlaceNr:int;// = -1
public var demoRand;// = null
public var demoPropertiesLoader:URLLoader;// = null
public var fixedBtns:Sprite;// = null
public var soundManager:SoundManager;// = null
public var renderer:Renderer;// = null
public var demoPlaceNr:int;// = -1
public var relaxUnusedHintsScore:int;// = 0
public var middleGameDialog;// = null
public var relaxScores:Array;// = null
public var relaxMode:Boolean;// = false
public var communicator:Communicator;// = null
public var relaxDataXml:Array;// = null
public var relaxTotalScore:int;// = 0
public var demoPlace:XML;// = null
public var game:Game;// = null
public var demoProperties:String;// = ""
public var gameLog:String;// = ""
public var gameTimer:GameTimer;// = null
public var intro:Intro;// = null
public static const DEMO:int = 4;
public static const GAME_TYPE:int = 1;
public static const DEV_MODE:int = 0;
public static const MONEY_GAME:int = 1;
public static const IS_DELUXE:Boolean = true;
public static const REPLAYER:int = 3;
public static const PRACTICE_GAME:int = 2;
public static const FIXED:int = 5;
public static var renderer:Renderer = null;
public static var gameDataXml:XML = null;
public static var main:Main = null;
public static var RELAX_LEVELS:int = 5;
public function Main(){
var _local1:int;
var _local2:Array;
var _local3:int;
var _local4:Sprite;
var _local5:Shape;
var _local6:TextField;
super();
Main.main = this;
renderer = new Renderer();
Main.renderer = renderer;
communicator = new Communicator();
soundManager = new SoundManager();
if (Main.GAME_TYPE != Main.FIXED){
intro = new Intro(this);
addChild(intro);
gameTimer = new GameTimer(Game.TICKS_PER_SECOND, null, renderer);
addEventListener("enterFrame", gameTimer.advanceTime);
};
if ((((Main.GAME_TYPE == Main.DEV_MODE)) || ((Main.GAME_TYPE == Main.REPLAYER)))){
fakeGameData();
} else {
if (Main.GAME_TYPE == Main.DEMO){
getDemoData();
} else {
if (Main.GAME_TYPE == Main.FIXED){
fixedBtns = new Sprite();
addChild(fixedBtns);
_local1 = 0;
if (Main.IS_DELUXE){
_local2 = Game.DELUXE_PLACES;
} else {
_local2 = Game.PLACES;
};
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = new Sprite();
_local4.y = _local1;
_local1 = (_local1 + 20);
fixedBtns.addChild(_local4);
_local5 = new Shape();
_local5.graphics.lineStyle(1, 0);
_local5.graphics.beginFill(0xFFFFFF);
_local5.graphics.drawRect(0, 0, 100, 20);
_local5.graphics.endFill();
_local4.addChild(_local5);
_local6 = new TextField();
_local6.setTextFormat(new TextFormat(null, 12));
_local6.text = String(_local2[_local3]);
_local6.selectable = false;
_local6.mouseEnabled = false;
_local4.addChild(_local6);
_local4.addEventListener(MouseEvent.CLICK, fixedStart);
_local3++;
};
} else {
getGameData();
};
};
};
}
public function getWord(_arg1:String):String{
var _local2:String;
var _local3 = "";
if (Main.IS_DELUXE){
_local3 = "0";
};
if (_arg1.length == 8){
_local2 = (((_arg1.substring(0, 3) + "_0") + _local3) + _arg1.substring(3, 4));
} else {
if (_arg1.length == 9){
_local2 = (((_arg1.substring(0, 3) + "_") + _local3) + _arg1.substring(3, 5));
} else {
_local2 = ((_arg1.substring(0, 3) + "_") + _arg1.substring(3, 6));
};
};
var _local4:int = demoProperties.indexOf(_local2);
_local4 = (demoProperties.indexOf("=", _local4) + 1);
var _local5:int = demoProperties.indexOf("\n", _local4);
if (_local5 == -1){
_local5 = demoProperties.length;
};
var _local6:String = demoProperties.substring(_local4, _local5);
return (_local6);
}
public function showMiddleGameDialog():void{
middleGameDialog = new MiddleGameDialog(-1, true, this);
addChild(middleGameDialog);
}
public function gameEnd(_arg1:int, _arg2:int):void{
relaxTotalScore = _arg1;
if ((((Main.GAME_TYPE == Main.MONEY_GAME)) || ((Main.GAME_TYPE == Main.PRACTICE_GAME)))){
communicator.sendFsCommand("gameEnd", ("" + _arg1));
};
}
public function showOutro():void{
outro = new Outro(game);
addChild(outro);
renderer.start(outro);
}
public function gameQuit(_arg1:Event=null):void{
if ((((Main.GAME_TYPE == Main.MONEY_GAME)) || ((Main.GAME_TYPE == Main.PRACTICE_GAME)))){
communicator.sendFsCommand("gameQuit", "");
};
trace("*****************************************************************************************");
trace(gameLog);
}
public function demoPropertiesLoaded(_arg1:Event):void{
var objs:Stack;
var objXml:XMLList;
var objNodes:XMLList;
var o:int;
var thingsToFind:Stack;
var i:int;
var words:String;
var j:int;
var shortStr:String;
var soundStr:String;
var musicStr:String;
var deluxeAdd:String;
var places:Array;
var graphicsPathAttribute:String;
var startTag:String;
var textTag:String;
var xmlStr:String;
var index:int;
var imageStr:String;
var event = _arg1;
demoProperties = String(demoPropertiesLoader.data);
objs = new Stack();
objXml = null;
objNodes = demoPlace.image.(String(@id).indexOf("obj") != -1);
o = 0;
while (o < objNodes.length()) {
objXml = XMLList(objNodes[o]);
objs.push(objXml);
o = (o + 1);
};
thingsToFind = new Stack();
i = 0;
while (i < Game.NO_THINGS_TO_FIND) {
index = 0;
do {
index = this.demoRand.nextInt(objs.size());
objXml = XMLList(objs.g(index));
} while (thingsToFind.indexOf(objXml) != -1);
thingsToFind.push(objXml);
i = (i + 1);
};
words = "<strings>";
j = 0;
while (j < thingsToFind.size()) {
imageStr = XMLList(thingsToFind.g(j));
words = (words + (((("<string id=\"" + j) + "\">") + getWord(imageStr)) + "</string>"));
j = (j + 1);
};
words = (words + "</strings>");
shortStr = " mode=\"short\"";
shortStr = "";
soundStr = " sound=\"on\"";
musicStr = " music=\"on\"";
deluxeAdd = "";
places = Game.PLACES;
if (Main.IS_DELUXE){
places = Game.DELUXE_PLACES;
deluxeAdd = "deluxe/";
};
graphicsPathAttribute = ((("graphicspath=\"amazingadventuresgraphics/" + deluxeAdd) + String(places[demoPlaceNr])) + ".swf\"");
startTag = (((((((((("<gamedata seed=\"" + demoSeed) + "\"") + "placenr=\"") + demoPlaceNr) + "\"") + graphicsPathAttribute) + shortStr) + soundStr) + musicStr) + ">");
textTag = "<text id=\"game_instructions_\">Game Instructions</text><text id=\"instruction_1_\">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas id libero. Morbi sollicitudin, nunc sit amet consectetur tempor, nisl neque facilisis leo, tincidunt tincidunt odio velit quis nibh. Phasellus ut risus non augue malesuada ultricies. Duis at tortor. Aenean vehicula tellus et enim. Mauris tempus tortor eget sem tincidunt vulputate.\rCurabitur suscipit varius purus. Nam fringilla sollicitudin urna. Maecenas et felis. Nulla interdum dignissim quam. Phasellus sit amet ante eget nisi ornare facilisis.</text><text id=\"instruction_2_\">Cras consequat suscipit turpis. Duis euismod purus ac arcu. Nunc \rdiam nulla, lacinia ut, fringilla a, molestie a, odio. \rIn lacinia molestie elit. Quisque ac ipsum et lorem viverra pretium. Quisque tincidunt nunc at dolor. Phasellus eget odio. \rQuisque semper. </text><text id=\"game_starts_in\">Game starts in</text><text id=\"game_ends_in_\">Game ends in</text><text id=\"seconds\">seconds</text><text id=\"middle_dialog_title_\">CONGRATULATIONS!</text><text id=\"you_found_all_\">You found all items! Now you must solve another puzzle.</text><text id=\"place_game_instruction\">Place all items back into the scene.</text><text id=\"spot_game_instruction\">Spot the difference between the two scenes.</text><text id=\"game_over_\">GAME OVER</text><text id=\"game_completed\">GAME COMPLETED</text><text id=\"time_is_up\">TIME IS UP</text><text id=\"level_1_\">LEVEL 1</text><text id=\"score_1_\">SCORE</text><text id=\"unused_hints_\">UNUSED HINTS</text><text id=\"speed_bonus_\">SPEED BONUS</text><text id=\"register_to_play_\">Register to play full version.....</text><text id=\"spot_game_\">LEVEL 2</text><text id=\"place_game_\">LEVEL 2</text><text id=\"time_bonus_\">TIME BONUS</text><text id=\"penalties_\">PENALTIES</text><text id=\"total_score_\">TOTAL SCORE</text><text id=\"gems_collected_\">Gems Collected</text><text id=\"score_\">Score</text><text id=\"items_left_\">Items Left</text><text id=\"hint_\">HINT</text><text id=\"of\">of</text><text id=\"speed_bonus_pop\">Speed Bonus</text><text id=\"amazon\">Amazon</text><text id=\"angkorwat\">Angkorwat</text><text id=\"ayersrock\">Ayers Rock</text><text id=\"barrierreef\">Barrier Reef</text><text id=\"beachhut\">Beach Hut</text><text id=\"castle\">Castle</text><text id=\"greatwall\">Great Wall</text><text id=\"greece\">Greece</text><text id=\"hawaii\">Hawaii</text><text id=\"hermitage\">Hermitage</text><text id=\"igauzufalls\">Igauzu Falls</text><text id=\"igloo\">Igloo</text><text id=\"london\">London</text><text id=\"machupicchu\">Machu Picchu</text><text id=\"morocco\">Morocco</text><text id=\"petra\">Petra</text><text id=\"port\">Port</text><text id=\"rockymnt\">Rocky Mountains</text><text id=\"serengeti\">Serengeti</text><text id=\"shipwreck\">Shipwreck</text><text id=\"speakeasy\">Speak Easy</text><text id=\"statueofliberty\">Statue of Liberty</text><text id=\"tajmahal\">Tajmahal</text><text id=\"temple\">Temple</text>";
if (Main.IS_DELUXE){
textTag = "<text id=\"game_instructions_\">Game Instructions</text><text id=\"instruction_1_\">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas id libero. Morbi sollicitudin, nunc sit amet consectetur tempor, nisl neque facilisis leo, tincidunt tincidunt odio velit quis nibh. Phasellus ut risus non augue malesuada ultricies. Duis at tortor. Aenean vehicula tellus et enim. Mauris tempus tortor eget sem tincidunt vulputate.\rCurabitur suscipit varius purus. Nam fringilla sollicitudin urna. Maecenas et felis. Nulla interdum dignissim quam. Phasellus sit amet ante eget nisi ornare facilisis.</text><text id=\"instruction_2_\">Cras consequat suscipit turpis. Duis euismod purus ac arcu. Nunc \rdiam nulla, lacinia ut, fringilla a, molestie a, odio. \rIn lacinia molestie elit. Quisque ac ipsum et lorem viverra pretium. Quisque tincidunt nunc at dolor. Phasellus eget odio. \rQuisque semper. </text><text id=\"game_starts_in\">Game starts in</text><text id=\"game_ends_in_\">Game ends in</text><text id=\"seconds\">seconds</text><text id=\"middle_dialog_title_\">CONGRATULATIONS!</text><text id=\"you_found_all_\">You found all items! Now you must solve another puzzle.</text><text id=\"place_game_instruction\">Place all items back into the scene.</text><text id=\"spot_game_instruction\">Spot the difference between the two scenes.</text><text id=\"game_over_\">GAME OVER</text><text id=\"game_completed\">GAME COMPLETED</text><text id=\"time_is_up\">TIME IS UP</text><text id=\"level_1_\">LEVEL 1</text><text id=\"score_1_\">SCORE</text><text id=\"unused_hints_\">UNUSED HINTS</text><text id=\"speed_bonus_\">SPEED BONUS</text><text id=\"register_to_play_\">Register to play full version.....</text><text id=\"spot_game_\">LEVEL 2</text><text id=\"place_game_\">LEVEL 2</text><text id=\"time_bonus_\">TIME BONUS</text><text id=\"penalties_\">PENALTIES</text><text id=\"total_score_\">TOTAL SCORE</text><text id=\"gems_collected_\">Gems Collected</text><text id=\"score_\">Score</text><text id=\"items_left_\">Items Left</text><text id=\"hint_\">HINT</text><text id=\"of\">of</text><text id=\"speed_bonus_pop\">Speed Bonus</text><text id=\"airplane\">Airplane</text><text id=\"archtent\">Archtent</text><text id=\"bar\">Bar</text><text id=\"bedroom\">Bedroom</text><text id=\"boat\">Boat</text><text id=\"cavepainting\">Cave Painting</text><text id=\"courtyard\">Courtyard</text><text id=\"digs\">Digs</text><text id=\"excavation\">Excavation</text><text id=\"garden\">Garden</text><text id=\"goldmask\">Gold Mask</text><text id=\"market\">Market</text><text id=\"mine\">Mine</text><text id=\"pyramid\">Pyramid</text><text id=\"shipwreck\">Shipwreck</text><text id=\"stable\">Stable</text><text id=\"temple\">Temple</text><text id=\"tent\">Tent</text><text id=\"throne\">Throne</text><text id=\"tomb\">Tomb</text><text id=\"treasure\"></text>Treasure<text id=\"underwater\">Underwater</text>";
};
xmlStr = ((((((((startTag + "\r") + textTag) + "\r") + words) + "\r") + String(demoPlace)) + "\r") + "</gamedata>");
Main.gameDataXml = new XML(xmlStr);
gameDataLoaded();
}
public function startGame(_arg1:Event=null):void{
if (relaxMode){
if (middleGameDialog != null){
middleGameDialog.destroy();
removeChild(middleGameDialog);
renderer.reset();
};
};
game.start();
if ((((Main.GAME_TYPE == Main.MONEY_GAME)) || ((Main.GAME_TYPE == Main.PRACTICE_GAME)))){
communicator.sendFsCommand("gameStart", "");
};
removeEventListener("enterFrame", gameTimer.advanceTime);
gameTimer = new GameTimer(Game.TICKS_PER_SECOND, game, renderer);
addEventListener("enterFrame", gameTimer.advanceTime);
addPlayData([Game.FIRST_TICK]);
}
protected function getDemoData():void{
var places:Array;
var loadError:Function;
loadError = function (_arg1:Event):void{
trace(("demoPlace load error " + _arg1));
};
demoSeed = (Math.random() * 1000);
demoRand = new Random(demoSeed);
if (Main.IS_DELUXE){
places = Game.DELUXE_PLACES;
} else {
places = Game.PLACES;
};
var r:int = demoRand.nextInt(int(places.length));
if (Main.GAME_TYPE == Main.FIXED){
demoPlaceNr = fixedPlaceNr;
} else {
demoPlaceNr = r;
};
demoPlaceLoader = new URLLoader();
demoPlaceLoader.addEventListener(Event.COMPLETE, demoXmlLoaded);
demoPlaceLoader.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var deluxeAdd = "";
if (Main.IS_DELUXE){
deluxeAdd = "deluxe/";
};
demoPlaceLoader.load(new URLRequest(((("amazingadventures/scenes/" + deluxeAdd) + String(places[demoPlaceNr])) + ".xml")));
var tempThingsToFind:Array = new Array();
}
public function loadFail():void{
var _local1:int;
var _local2:int;
while (_local2 < relaxScores.length) {
_local1 = (_local1 + int(relaxScores[_local2]));
_local2++;
};
gameEnd(_local1, Game.LOAD_SWF_FAIL);
}
public function prepareNextRelaxGame():void{
Main.gameDataXml = XML(String(relaxDataXml[relaxGameNr]));
Main.gameDataXml.appendChild(relaxTextXml);
Image.LoadSwf(this, Main.gameDataXml.@graphicspath);
}
protected function fakeGameData():void{
var myLoader:URLLoader;
var xmlLoaded:Function;
var loadError:Function;
xmlLoaded = function (_arg1:Event):void{
Main.gameDataXml = new XML(myLoader.data);
gameDataLoaded();
};
loadError = function (_arg1:Event):void{
trace(("xml load error " + _arg1));
};
myLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, xmlLoaded);
myLoader.addEventListener(IOErrorEvent.IO_ERROR, loadError);
if (Main.IS_DELUXE){
trace("deluxe");
myLoader.load(new URLRequest("amazingadventures/DevModeGameDataDeluxe.xml"));
} else {
trace("normal");
myLoader.load(new URLRequest("amazingadventures/DevModeGameData.xml"));
};
}
protected function getGameData():void{
var _local1:Object = ExternalInterface.call("getGameData");
if (((!((_local1 == null))) && (_local1.success))){
Main.gameDataXml = new XML(_local1.message);
gameDataLoaded();
} else {
log("Error: Could not load game Data!");
};
}
public function middleGameDialogStarted():void{
game.destroy();
removeChild(game.c);
game = null;
relaxGameNr++;
prepareNextRelaxGame();
}
public function addPlayData(_arg1:Array):void{
var _local2:int = (gameTimer.currentTick + 1);
_arg1.splice(1, 0, _local2);
game.addPlayData(_arg1);
if ((((Main.GAME_TYPE == Main.MONEY_GAME)) && (!(relaxMode)))){
communicator.sendPlayData(_arg1);
};
}
public function log(_arg1:String):void{
gameLog = (gameLog + (_arg1 + "\n"));
}
public function fixedStart(_arg1:MouseEvent):void{
fixedPlaceNr = fixedBtns.getChildIndex(Sprite(_arg1.target));
while (fixedBtns.numChildren > 0) {
Sprite(fixedBtns.getChildAt(0)).removeEventListener(MouseEvent.CLICK, fixedStart);
fixedBtns.removeChildAt(0);
};
intro = new Intro(this);
addChild(intro);
gameTimer = new GameTimer(Game.TICKS_PER_SECOND, null, renderer);
addEventListener("enterFrame", gameTimer.advanceTime);
getDemoData();
}
public function demoXmlLoaded(_arg1:Event):void{
var loadError:Function;
var event = _arg1;
loadError = function (_arg1:Event):void{
trace(("demoProperties load error " + _arg1));
};
demoPlace = new XML(demoPlaceLoader.data);
demoPropertiesLoader = new URLLoader();
demoPropertiesLoader.addEventListener(Event.COMPLETE, demoPropertiesLoaded);
demoPropertiesLoader.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var deluxeAdd = "";
var places:Array = Game.PLACES;
if (Main.IS_DELUXE){
places = Game.DELUXE_PLACES;
deluxeAdd = "deluxe/";
};
demoPropertiesLoader.load(new URLRequest((((("amazingadventures/properties/" + deluxeAdd) + "amazing_adventures_") + String(places[demoPlaceNr])) + ".properties")));
}
public function gameDataLoaded():void{
if (Main.gameDataXml.@sound == "off"){
soundManager.toggleSound();
};
if (Main.gameDataXml.@music == "off"){
soundManager.toggleMusic();
};
soundManager.startIntroSound();
ScorePop.speedBonusStr = Main.gameDataXml.text.(@id == "speed_bonus_pop");
if (Main.gameDataXml.@relaxMode == "true"){
relaxMode = true;
prepareRelaxGames();
} else {
Image.LoadSwf(this, Main.gameDataXml.@graphicspath);
};
}
public function graphicsLoaded():void{
var _local1:int = Main.gameDataXml.@seed;
game = new Game(this, _local1);
if (relaxMode){
if (relaxGameNr == 0){
intro.init();
} else {
middleGameDialog.nextRelaxGameLodaded();
};
} else {
intro.init();
};
}
public function prepareRelaxGames():void{
var relaxXml:XMLList;
relaxTextXml = Main.gameDataXml.text;
relaxDataXml = new Array();
var i:int;
while (i < Main.RELAX_LEVELS) {
relaxXml = Main.gameDataXml.relaxgame.(@id == i);
relaxDataXml.push(relaxXml);
i = (i + 1);
};
relaxScores = new Array();
prepareNextRelaxGame();
}
}
}//package amazingadventures
Section 27
//Obj (amazingadventures.Obj)
package amazingadventures {
import amazingadventures.client.*;
public class Obj {
public var spot:int;// = -1
public var c:ObjC;// = null
public var nr:int;// = -1
public var place:int;// = -1
public var game:Game;// = null
public var id:String;// = ""
public static const NOT_SET:int = -1;
public static const LEFT:int = 0;
public static const RIGHT:int = 1;
public function Obj(_arg1:Game, _arg2:XMLList){
this.game = _arg1;
id = _arg2.@id;
nr = parseInt(id.substring(3));
spot = getSide(_arg2.@spot);
place = getSide(_arg2.@place);
c = new ObjC(this, _arg2);
}
public function toString():String{
return ((((((((((((((("[" + id) + " ") + nr) + " s:") + spot) + " p:") + place) + " ") + c.image) + " ") + c.x) + " ") + c.y) + "]"));
}
private function getSide(_arg1:String):int{
if (_arg1 == "L"){
return (Obj.LEFT);
};
if (_arg1 == "R"){
return (Obj.RIGHT);
};
return (Obj.NOT_SET);
}
}
}//package amazingadventures
Section 28
//PlaceGame (amazingadventures.PlaceGame)
package amazingadventures {
import util.*;
import amazingadventures.client.*;
public class PlaceGame {
public var leftObjs:Stack;// = null
public var draggedObj:Obj;// = null
public var excludedObjs:Stack;// = null
public var score:int;// = 0
public var rightObjs:Stack;// = null
public var lastHitTick:int;// = -1
public var objs:Stack;// = null
public var speedBonus:int;// = 0
public var c:PlaceGameC;// = null
public var sideOfScene:int;// = -1
public var game:Game;// = null
public static const WRONG_OBJ:int = -50;
public static const OBJ_POINTS:int = 250;
public static const MAX_SPEED_BONUS:int = 25;
public static const TICKS_PER_SPEED_POINT:int = 12;
public static const NO_THINGS_TO_PLACE:int = 10;
public function PlaceGame(_arg1:Game){
var _local5:int;
var _local6:Boolean;
super();
this.game = _arg1;
sideOfScene = _arg1.rand.nextInt(2);
_arg1.main.log(("sideOfScene " + sideOfScene));
var _local2:Obj;
objs = new Stack();
var _local3:int;
while (_local3 < _arg1.objs.size()) {
_local2 = Obj(_arg1.objs.g(_local3));
if (_local2.place == sideOfScene){
objs.push(_local2);
};
_local3++;
};
excludedObjs = new Stack();
leftObjs = new Stack();
rightObjs = new Stack();
var _local4:int;
while (_local4 < PlaceGame.NO_THINGS_TO_PLACE) {
_local5 = 0;
do {
_local5 = _arg1.rand.nextInt(objs.size());
_local2 = Obj(objs.g(_local5));
} while (((!((leftObjs.indexOf(_local2) == -1))) || (!((rightObjs.indexOf(_local2) == -1)))));
_local6 = (_arg1.rand.nextInt(2) == 1);
excludedObjs.push(_local2);
if (_local6){
rightObjs.push(_local2);
_arg1.main.log(("right " + _local2.nr));
} else {
leftObjs.push(_local2);
_arg1.main.log(("left " + _local2.nr));
};
_local4++;
};
c = new PlaceGameC(this);
}
public function executeInput(_arg1:Array, _arg2:int, _arg3:int, _arg4:int):Boolean{
var _local5:Boolean;
switch (_arg2){
case Game.INPUT_IMAGE_DRAG:
startImageDrag(String(_arg1[2]));
break;
case Game.INPUT_IMAGE_DROP:
imageDropped(Boolean(_arg1[2]), _arg4);
break;
case Game.INPUT_PUT_BACK:
putBack(_arg4);
break;
case Game.INPUT_BG_CLICKED:
break;
case Game.INPUT_HINT:
giveHint();
break;
default:
_local5 = false;
};
return (_local5);
}
public function putBack(_arg1:int):void{
c.animatePutBack(_arg1);
draggedObj = null;
}
public function imageDropped(_arg1:Boolean, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:int;
if (_arg1){
score = (score + PlaceGame.OBJ_POINTS);
game.main.log("success");
_local3 = excludedObjs.indexOf(draggedObj);
excludedObjs.remove(_local3);
_local3 = leftObjs.indexOf(draggedObj);
if (_local3 != -1){
leftObjs.remove(_local3);
};
_local3 = rightObjs.indexOf(draggedObj);
if (_local3 != -1){
rightObjs.remove(_local3);
};
if (game.main.relaxMode){
_local4 = 0;
} else {
_local4 = game.getSpeedBonus(PlaceGame.MAX_SPEED_BONUS, PlaceGame.TICKS_PER_SPEED_POINT, _arg2, lastHitTick);
};
speedBonus = (speedBonus + _local4);
game.main.log(("speedBonus " + _local4));
game.spyGame.logScore();
logScore();
lastHitTick = _arg2;
if (excludedObjs.size() == 0){
lastHitTick = -1;
if (((game.main.relaxMode) && ((game.main.relaxGameNr == (Main.RELAX_LEVELS - 1))))){
game.gameEnd(game.main.gameTimer.currentTick, Game.RELAX_COMPLETE);
} else {
game.gameEnd(game.main.gameTimer.currentTick, Game.COMPLETED);
};
};
c.animateSuccess(PlaceGame.OBJ_POINTS, _local4);
} else {
game.main.log("fail");
if (game.main.relaxMode){
game.relaxWrongObj(_arg2);
c.animateFailure(game.main.gameTimer.currentTick, 0);
game.c.updateRelaxHints();
} else {
_local5 = game.subtractPenalty(SpotGame.WRONG_OBJ);
game.spyGame.logScore();
logScore();
c.animateFailure(game.main.gameTimer.currentTick, _local5);
};
};
draggedObj = null;
}
public function startImageDrag(_arg1:String):void{
var _local2:int = parseInt(_arg1.substr(3));
var _local3:Obj = game.getObj(_local2);
if (excludedObjs.indexOf(_local3) != -1){
draggedObj = _local3;
c.startImageDrag(_arg1);
};
}
public function logScore():void{
game.main.log(((("place game score: " + score) + " speedBonus ") + speedBonus));
}
public function giveHint():void{
if (game.main.relaxMode){
if (game.main.relaxHints > 0){
game.main.relaxHints--;
c.giveHint();
};
} else {
if (!game.hintUsed){
game.hintUsed = true;
c.giveHint();
};
};
}
}
}//package amazingadventures
Section 29
//SpotGame (amazingadventures.SpotGame)
package amazingadventures {
import util.*;
import amazingadventures.client.*;
public class SpotGame {
public var rightExcludedObjs:Stack;// = null
public var c:SpotGameC;// = null
public var leftExcludedObjs:Stack;// = null
public var excludedObjs:Stack;// = null
public var score:int;// = 0
public var speedBonus:int;// = 0
public var game:Game;// = null
public var lastHitTick:int;// = -1
public var objs:Stack;// = null
public var sideOfScene:int;// = -1
public static const NO_THINGS_TO_FIND:int = 10;
public static const WRONG_OBJ:int = -50;
public static const OBJ_POINTS:int = 250;
public static const MAX_SPEED_BONUS:int = 25;
public static const TICKS_PER_SPEED_POINT:int = 12;
public function SpotGame(_arg1:Game){
var _local5:int;
var _local6:Boolean;
super();
this.game = _arg1;
sideOfScene = _arg1.rand.nextInt(2);
_arg1.main.log(("sideOfScene " + sideOfScene));
var _local2:Obj;
objs = new Stack();
var _local3:int;
while (_local3 < _arg1.objs.size()) {
_local2 = Obj(_arg1.objs.g(_local3));
if (_local2.spot == sideOfScene){
objs.push(_local2);
};
_local3++;
};
excludedObjs = new Stack();
leftExcludedObjs = new Stack();
rightExcludedObjs = new Stack();
var _local4:int;
while (_local4 < SpotGame.NO_THINGS_TO_FIND) {
_local5 = 0;
do {
_local5 = _arg1.rand.nextInt(objs.size());
_local2 = Obj(objs.g(_local5));
} while (((!((leftExcludedObjs.indexOf(_local2) == -1))) || (!((rightExcludedObjs.indexOf(_local2) == -1)))));
_local6 = (_arg1.rand.nextInt(2) == 1);
excludedObjs.push(_local2);
if (_local6){
rightExcludedObjs.push(_local2);
_arg1.main.log(("right missing " + _local2.nr));
} else {
leftExcludedObjs.push(_local2);
_arg1.main.log(("left missing " + _local2.nr));
};
_local4++;
};
c = new SpotGameC(this);
}
public function giveHint():void{
if (game.main.relaxMode){
if (game.main.relaxHints > 0){
game.main.relaxHints--;
c.giveHint();
};
} else {
if (!game.hintUsed){
game.hintUsed = true;
c.giveHint();
};
};
}
public function spotClick(_arg1:String, _arg2:int, _arg3:int, _arg4:int):void{
var _local6:Obj;
var _local7:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local5:Boolean;
var _local8 = -1;
if (_arg1 != "background"){
_local9 = 0;
while (_local9 < excludedObjs.size()) {
_local6 = Obj(excludedObjs.g(_local9));
if (_arg1 == _local6.id){
_local5 = true;
_local7 = excludedObjs.indexOf(_local6);
excludedObjs.remove(_local7);
_local7 = leftExcludedObjs.indexOf(_local6);
if (_local7 != -1){
_local8 = 1;
leftExcludedObjs.remove(_local7);
};
_local7 = rightExcludedObjs.indexOf(_local6);
if (_local7 != -1){
_local8 = 0;
rightExcludedObjs.remove(_local7);
};
if (game.main.relaxMode){
_local10 = 0;
} else {
_local10 = game.getSpeedBonus(SpotGame.MAX_SPEED_BONUS, SpotGame.TICKS_PER_SPEED_POINT, _arg4, lastHitTick);
};
speedBonus = (speedBonus + _local10);
lastHitTick = _arg4;
break;
};
_local9++;
};
};
if (_local5){
game.main.log("success");
score = (score + SpotGame.OBJ_POINTS);
game.spyGame.logScore();
logScore();
c.animateSuccess(SpotGame.OBJ_POINTS, _local6, _local8, _arg4, _local10);
if (excludedObjs.size() == 0){
lastHitTick = -1;
if (((game.main.relaxMode) && ((game.main.relaxGameNr == (Main.RELAX_LEVELS - 1))))){
game.gameEnd(game.main.gameTimer.currentTick, Game.RELAX_COMPLETE);
} else {
game.gameEnd(game.main.gameTimer.currentTick, Game.COMPLETED);
};
};
} else {
game.main.log("fail");
if (game.main.relaxMode){
game.relaxWrongObj(_arg4);
c.animateFailure(_arg2, _arg3, 0);
game.c.updateRelaxHints();
} else {
_local11 = game.subtractPenalty(SpotGame.WRONG_OBJ);
game.spyGame.logScore();
logScore();
c.animateFailure(_arg2, _arg3, _local11);
};
};
}
public function logScore():void{
game.main.log(((("spot game score: " + score) + " speedBonus ") + speedBonus));
}
public function executeInput(_arg1:Array, _arg2:int, _arg3:int, _arg4:int):Boolean{
var _local5:Boolean;
switch (_arg2){
case Game.INPUT_SPOT_CLICK:
spotClick(String(_arg1[2]), int(_arg1[3]), int(_arg1[4]), _arg4);
break;
case Game.INPUT_BG_CLICKED:
break;
case Game.INPUT_HINT:
giveHint();
break;
default:
_local5 = false;
};
return (_local5);
}
}
}//package amazingadventures
Section 30
//SpyGame (amazingadventures.SpyGame)
package amazingadventures {
import util.*;
import amazingadventures.client.*;
public class SpyGame {
public var thingsToFind:Stack;// = null
public var score:int;// = 0
public var c:SpyGameC;// = null
public var foundThings:Stack;// = null
public var completed:Boolean;// = false
public var game:Game;// = null
public var speedBonus:int;// = 0
public var lastHitTick:int;// = -1
public static const WRONG_OBJ:int = -50;
public static const OBJ_POINTS:int = 250;
public static const MAX_SPEED_BONUS:int = 25;
public static const TICKS_PER_SPEED_POINT:int = Math.floor((0.2 * Game.TICKS_PER_SECOND));
public function SpyGame(_arg1:Game){
var _local3:int;
var _local4:Obj;
super();
this.game = _arg1;
thingsToFind = new Stack();
foundThings = new Stack();
_arg1.main.log("thingsToFind:");
var _local2:int;
while (_local2 < Game.NO_THINGS_TO_FIND) {
_local3 = 0;
do {
_local3 = _arg1.rand.nextInt(_arg1.objs.size());
_local4 = Obj(_arg1.objs.g(_local3));
} while (thingsToFind.indexOf(_local4) != -1);
thingsToFind.push(_local4);
_arg1.main.log(("obj " + _local4.nr));
_local2++;
};
c = new SpyGameC(this);
}
public function bgClicked(_arg1:int, _arg2:int):void{
var _local3:int;
game.main.log("wrong obj background");
if (game.main.relaxMode){
game.relaxWrongObj(game.main.gameTimer.currentTick);
c.wrongThing(_arg1, _arg2, 0);
game.c.updateRelaxHints();
} else {
_local3 = game.subtractPenalty(SpyGame.WRONG_OBJ);
logScore();
c.wrongThing(_arg1, _arg2, _local3);
};
}
public function thingClicked(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local7:Obj;
var _local8:int;
var _local9:int;
var _local5:Boolean;
var _local6:int;
while (_local6 < thingsToFind.size()) {
_local7 = Obj(thingsToFind.g(_local6));
if ((((foundThings.indexOf(_local7) == -1)) && ((_arg1 == _local7.nr)))){
game.main.log(("found " + _local7.id));
_local5 = true;
foundThings.push(_local7);
score = (score + SpyGame.OBJ_POINTS);
if (game.main.relaxMode){
_local8 = 0;
} else {
_local8 = game.getSpeedBonus(SpyGame.MAX_SPEED_BONUS, SpyGame.TICKS_PER_SPEED_POINT, _arg4, lastHitTick);
};
speedBonus = (speedBonus + _local8);
logScore();
lastHitTick = _arg4;
c.thingFound(_local7, _local6, SpyGame.OBJ_POINTS, _local8);
c.checkForShortGameEnd();
if (foundThings.size() >= Game.NO_THINGS_TO_FIND){
completed = true;
lastHitTick = -1;
game.spyGameEnded();
c.deActivate();
};
break;
};
_local6++;
};
if (!_local5){
game.main.log(("wrong obj " + _arg1));
if (game.main.relaxMode){
game.relaxWrongObj(_arg4);
c.wrongThing(_arg2, _arg3, 0);
game.c.updateRelaxHints();
} else {
_local9 = game.subtractPenalty(SpyGame.WRONG_OBJ);
logScore();
c.wrongThing(_arg2, _arg3, _local9);
};
};
}
public function executeInput(_arg1:Array, _arg2:int, _arg3:int, _arg4:int):Boolean{
var _local5:Boolean;
switch (_arg2){
case Game.THING_CLICKED:
thingClicked(parseInt(_arg1[2]), int(_arg1[3]), int(_arg1[4]), _arg4);
break;
case Game.INPUT_BG_CLICKED:
bgClicked(int(_arg1[2]), int(_arg1[3]));
break;
case Game.INPUT_HINT:
giveHint();
break;
default:
_local5 = false;
};
return (_local5);
}
public function cleanUp():void{
c.removeGraphics();
thingsToFind = null;
foundThings = null;
}
public function logScore():void{
game.main.log(((("spy game score: " + score) + " speedBonus ") + speedBonus));
}
public function giveHint():void{
if (game.main.relaxMode){
if (game.main.relaxHints > 0){
game.main.relaxHints--;
c.giveHint();
};
} else {
if (!game.hintUsed){
game.hintUsed = true;
c.giveHint();
};
};
}
}
}//package amazingadventures
Section 31
//ChainResize (util.ChainResize)
package util {
import flash.display.*;
public class ChainResize {
var displayObject:DisplayObject;
var points:Array;
var from:ResizePoint;
var to:ResizePoint;
public function ChainResize(_arg1:DisplayObject){
this.displayObject = _arg1;
points = new Array();
}
public function update(_arg1:int, _arg2:Number):int{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
if (from == null){
from = shift();
to = shift();
};
if (_arg1 >= to.tick){
if (points.length > 0){
from = to;
to = shift();
} else {
displayObject.scaleX = to.scaleX;
displayObject.scaleY = to.scaleY;
return (Renderer.STOP);
};
};
if (((!((from == null))) && (!((to == null))))){
_local3 = (to.tick - from.tick);
_local4 = (to.scaleX - from.scaleX);
_local5 = (to.scaleY - from.scaleY);
_local6 = (((_arg1 + _arg2) - from.tick) / _local3);
displayObject.scaleX = (from.scaleX + (_local4 * _local6));
displayObject.scaleY = (from.scaleY + (_local5 * _local6));
};
return (Renderer.CONTINUE);
}
public function addResize(_arg1:int, _arg2:Number, _arg3:Number):void{
points.push(new ResizePoint(_arg1, _arg2, _arg3));
}
public function shift():ResizePoint{
return (ResizePoint(points.shift()));
}
}
}//package util
Section 32
//Communicator (util.Communicator)
package util {
import flash.external.*;
import flash.system.*;
public class Communicator {
public function sendFsCommand(_arg1:String, _arg2:String):void{
fscommand(_arg1, _arg2);
}
public function sendPlayData(_arg1:Array):void{
var _local2:String = ((String(_arg1[0]) + ",") + String(_arg1[1]));
var _local3:int = _arg1.length;
var _local4 = 2;
while (_local4 < _local3) {
_local2 = (_local2 + (" " + String(_arg1[_local4])));
_local4++;
};
_local2 = (_local2 + "=0");
ExternalInterface.call("playData", _local2);
}
}
}//package util
Section 33
//Fader (util.Fader)
package util {
import flash.display.*;
public class Fader {
public var displayObject:DisplayObject;
public var endAlpha:Number;// = 0
public var startTick:int;// = -1
public var totalTicks:int;// = -1
public var alphaChange:Number;// = 0
public var startAlpha:Number;// = 0
public var endTick:int;// = -1
public function Fader(_arg1:DisplayObject, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number){
this.displayObject = _arg1;
this.startTick = _arg2;
this.endTick = _arg3;
this.totalTicks = (_arg3 - _arg2);
this.startAlpha = _arg4;
this.endAlpha = _arg5;
this.alphaChange = (_arg5 - _arg4);
}
public function update(_arg1:int, _arg2:Number):Boolean{
var _local4:Number;
var _local3:Boolean;
if (_arg1 >= startTick){
if (_arg1 >= endTick){
displayObject.alpha = endAlpha;
_local3 = true;
} else {
_local4 = (((_arg1 + _arg2) - startTick) / totalTicks);
displayObject.alpha = (startAlpha + (alphaChange * _local4));
};
};
return (_local3);
}
}
}//package util
Section 34
//FramePlayer (util.FramePlayer)
package util {
import flash.display.*;
public class FramePlayer {
public var movieClip:MovieClip;
public var remainingRepeats:int;
public var forward:Boolean;
public var ticks:int;
public var endTick:int;
public var startTick:int;
public function FramePlayer(_arg1:MovieClip, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean=true){
this.movieClip = _arg1;
this.startTick = _arg2;
this.ticks = _arg3;
this.endTick = (_arg2 + _arg3);
this.forward = _arg5;
remainingRepeats = _arg4;
}
public function update(_arg1:int, _arg2:Number):int{
var _local3:int;
var _local4:Number;
var _local5:int;
if (_arg1 >= startTick){
if (_arg1 >= endTick){
if (remainingRepeats-- > 0){
endTick = (_arg1 + ticks);
startTick = _arg1;
update(_arg1, _arg2);
} else {
movieClip.gotoAndStop(getFrame(movieClip.totalFrames));
return (Renderer.STOP);
};
} else {
_local3 = (_arg1 - startTick);
_local4 = (_local3 / ticks);
_local5 = (1 + (_local4 * movieClip.totalFrames));
movieClip.gotoAndStop(getFrame(_local5));
};
};
return (Renderer.CONTINUE);
}
protected function getFrame(_arg1:int):int{
if (forward){
return (_arg1);
};
return (((movieClip.totalFrames + 1) - _arg1));
}
}
}//package util
Section 35
//Integer64 (util.Integer64)
package util {
import util.*;
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 _local5:*;
var _local6:*;
var _local2:* = ((_arg1 / 15) >> 0);
var _local3:* = (_arg1 - (_local2 * 15));
var _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));
}
public function add32(_arg1:Number):void{
var _local2:* = 0;
var _local3:* = (_arg1 & 32767);
_arg1 = (_arg1 >> 15);
var _local4:* = (_arg1 & 32767);
_arg1 = (_arg1 >> 15);
var _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 binaryShiftLeft(_arg1:Number):void{
var _local2:* = 0;
while (_local2 < _arg1) {
shl();
_local2++;
};
}
public function mul64(_arg1:Integer64):void{
var _local4:*;
var _local2:* = 0;
var _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:* = 0;
var _local2:* = 0;
var _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:* = 0;
while (_local2 < p.length) {
p[_local2] = _arg1.p[_local2];
_local2++;
};
}
private function merge(_arg1:Number):Number{
var _local2:* = 0;
while (_local2 < 3) {
p[_local2] = (p[_local2] + (_arg1 & 32767));
_arg1 = (_arg1 >>> 15);
_local2++;
};
return (_arg1);
}
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 _local4:*;
var _local2:* = 0;
s[0] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
s[1] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
s[2] = (_arg1 & 3);
var _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:* = 0;
var _local2:* = 0;
var _local3:* = 0;
var _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:* = 0;
var _local3:* = 1;
var _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 util
Section 36
//Movement (util.Movement)
package util {
import flash.display.*;
public class Movement {
public var displayObject:DisplayObject;
public var distanceX:Number;
public var endY:Number;
public var distanceY:Number;
public var totalTicks:int;
public var startX:Number;
public var startY:Number;
public var endTick:int;
public var endX:Number;
public var startTick:int;
public function Movement(_arg1:DisplayObject, _arg2:int, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number){
this.displayObject = _arg1;
this.startTick = _arg2;
this.endTick = _arg3;
this.totalTicks = (_arg3 - _arg2);
this.startX = _arg4;
this.startY = _arg5;
this.endX = _arg6;
this.endY = _arg7;
this.distanceX = (_arg6 - _arg4);
this.distanceY = (_arg7 - _arg5);
}
public function update(_arg1:int, _arg2:Number):Boolean{
var _local4:Number;
var _local3:Boolean;
if (_arg1 >= startTick){
if (_arg1 >= endTick){
displayObject.x = endX;
displayObject.y = endY;
_local3 = true;
} else {
_local4 = (((_arg1 + _arg2) - startTick) / totalTicks);
displayObject.x = (startX + (distanceX * _local4));
displayObject.y = (startY + (distanceY * _local4));
};
};
return (_local3);
}
}
}//package util
Section 37
//Random (util.Random)
package util {
import flash.utils.*;
public class Random {
private var mta:Array;
private var mti:Number;
private var lastSeed:Number;
private static var MATRIX_A:Number = 2567483615;
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{
_arg1 = int(_arg1);
var _local2:* = getTimer();
lastSeed = _arg1;
mta[0] = _arg1;
var _local3:* = _arg1;
var _local4:* = new Integer64(null);
var _local5:Number = N;
mti = 1;
while (mti < _local5) {
_local4.init32(((_local3 >>> 30) ^ _local3));
_local4.mulu32(1812433253);
_local3 = (mta[mti] = int((_local4.lsb + mti)));
mti++;
};
var _local6:* = getTimer();
}
public function nextFloat(){
return ((next(24) / (1 << 24)));
}
public function nextDouble(){
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 set seed(_arg1:Number){
init_genrand(_arg1);
}
public function nextInt(_arg1:Number){
return (((genrand_int32() & 2147483647) % _arg1));
}
private function genrand_int32(){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local1:Number = N;
var _local2:Number = 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 util
Section 38
//ReLoader (util.ReLoader)
package util {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
public class ReLoader {
public var urlRequest:URLRequest;// = null
public var path:String;// = null
public var maxErrorCount:int;// = 3
public var loader:Loader;// = null
public var listener:Object;// = null
private var errorCount:int;// = 0
public function ReLoader(_arg1:Object, _arg2:String){
this.listener = _arg1;
this.path = _arg2;
urlRequest = new URLRequest(_arg2);
}
private function errorHandler(_arg1:Event):void{
var _local2:Timer;
stopListening();
errorCount++;
if (errorCount < maxErrorCount){
_local2 = new Timer(100, 1);
_local2.start();
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, doLoad);
} else {
listener.loadFail(this);
};
}
public function load():void{
doLoad();
}
private function doLoad(_arg1:Event=null):void{
loader = new Loader();
loader.load(urlRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
}
private function completeHandler(_arg1:Event):void{
stopListening();
listener.loadSuccess(this);
}
private function stopListening():void{
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
}
}
}//package util
Section 39
//Renderable (util.Renderable)
package util {
public interface Renderable {
function render(_arg1:int, _arg2:Number):int;
}
}//package util
Section 40
//Renderer (util.Renderer)
package util {
import flash.display.*;
public class Renderer {
private var objectsToRender:Array;
public static const STOP_REMOVE:int = 3;
public static const STOP:int = 1;
public static const CONTINUE:int = 0;
public static const STOP_HIDE:int = 2;
public function Renderer(){
objectsToRender = new Array();
}
public function update(_arg1:int, _arg2:Number):void{
var _local4:Renderable;
var _local5:int;
var _local3:int = (objectsToRender.length - 1);
while (_local3 >= 0) {
_local4 = Renderable(objectsToRender[_local3]);
_local5 = _local4.render(_arg1, _arg2);
if (_local5 != Renderer.CONTINUE){
stop(_local4);
if (_local5 == Renderer.STOP_HIDE){
DisplayObject(_local4).visible = false;
} else {
if (_local5 == Renderer.STOP_REMOVE){
DisplayObject(_local4).parent.removeChild(DisplayObject(_local4));
};
};
};
_local3--;
};
}
public function start(_arg1:Renderable):void{
var _local2:int = objectsToRender.indexOf(_arg1, 0);
if (_local2 == -1){
objectsToRender.push(_arg1);
};
}
public function stop(_arg1:Renderable):void{
var _local2:int = objectsToRender.indexOf(_arg1, 0);
if (_local2 != -1){
objectsToRender.splice(_local2, 1);
};
}
public function reset():void{
objectsToRender = new Array();
}
}
}//package util
Section 41
//ResizePoint (util.ResizePoint)
package util {
public class ResizePoint {
public var scaleX:Number;
public var tick:int;
public var scaleY:Number;
public function ResizePoint(_arg1:int, _arg2:Number, _arg3:Number){
this.tick = _arg1;
this.scaleX = _arg2;
this.scaleY = _arg3;
}
}
}//package util
Section 42
//RetryLoader (util.RetryLoader)
package util {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class RetryLoader {
public var verbose:Boolean;// = false
public var failed:Boolean;
public var lastHttpStatus:int;
public var maxFails:int;// = 10
public var lastError:String;
public var loader:Loader;
private var failCount:int;
private var url:String;
public var progress:int;
private var retryTimer:Timer;
public function RetryLoader(_arg1:String){
progress = 0;
failed = false;
failCount = 0;
lastError = "";
this.url = _arg1;
}
public function ioError(_arg1:IOErrorEvent):void{
fail(_arg1.text);
}
private function fail(_arg1:String):void{
if (loader == null){
return;
};
loader = null;
failCount++;
if (verbose){
trace(((("fail #" + failCount) + ": ") + _arg1));
};
if (failCount >= maxFails){
failed = true;
} else {
lastError = _arg1;
retryTimer = new Timer(1500, 1);
retryTimer.addEventListener(TimerEvent.TIMER_COMPLETE, retry);
retryTimer.start();
};
}
public function httpStatus(_arg1:HTTPStatusEvent):void{
lastHttpStatus = _arg1.status;
if (_arg1.status == 0){
lastHttpStatus = 200;
};
}
public function retry(_arg1:TimerEvent):void{
if (verbose){
trace(("retry: " + _arg1));
};
retryTimer = null;
load();
}
public function load():void{
if (verbose){
trace(("Loading " + url));
};
var _local1:LoaderContext = new LoaderContext();
_local1.checkPolicyFile = true;
_local1.applicationDomain = ApplicationDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatus);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressEvent);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
loader.load(new URLRequest(url), _local1);
}
public function complete(_arg1:Event):void{
if (int((lastHttpStatus / 100)) != 2){
fail(("Bad server reply: " + lastHttpStatus));
return;
};
lastError = ("Loaded: " + loader.contentLoaderInfo.bytesTotal);
if (verbose){
trace(("complete: " + _arg1));
};
progress = 100;
}
public function progressEvent(_arg1:ProgressEvent):void{
progress = ((_arg1.bytesLoaded * 100) / _arg1.bytesTotal);
if (progress > 99){
progress = 99;
};
}
}
}//package util
Section 43
//SoundFader (util.SoundFader)
package util {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class SoundFader {
private var miniStep:Number;// = 0.01
private var millisec:int;
private var timer:Timer;
private var fadeStep:Number;// = 0.03
private var nrOfSteps:int;
private var panning:Number;
private var listener:Object;
private var extraRepeats:int;// = 5
public var soundChannel:SoundChannel;
public function SoundFader(_arg1:SoundChannel, _arg2:int, _arg3:Object=null){
this.soundChannel = _arg1;
this.millisec = _arg2;
this.listener = _arg3;
var _local4:Number = _arg1.soundTransform.volume;
nrOfSteps = (_local4 / fadeStep);
panning = _arg1.soundTransform.pan;
var _local5:int = (_arg2 / nrOfSteps);
timer = new Timer(_local5, (nrOfSteps + extraRepeats));
timer.addEventListener("timer", fade);
timer.addEventListener("timerComplete", destroy);
timer.start();
}
public function destroy(_arg1:TimerEvent):void{
soundChannel.stop();
if (listener != null){
listener.soundFaderCompleted(this);
};
}
public function fade(_arg1:TimerEvent):void{
var _local2:Number = soundChannel.soundTransform.volume;
if (_local2 > fadeStep){
_local2 = (_local2 - fadeStep);
} else {
_local2 = (_local2 - miniStep);
};
if (_local2 < 0){
_local2 = 0;
};
soundChannel.soundTransform = new SoundTransform(_local2, panning);
}
}
}//package util
Section 44
//Stack (util.Stack)
package util {
public class Stack {
protected var array:Array;
public function Stack(){
array = new Array();
}
public function add(_arg1:int, _arg2):void{
if ((((_arg1 < 0)) || ((_arg1 > array.length)))){
throw (new Error(((("index " + _arg1) + " out of range ") + array.length)));
};
array.splice(_arg1, 0, _arg2);
}
public function s(_arg1:int, _arg2){
var _local3:*;
if ((((_arg1 < 0)) || ((_arg1 >= array.length)))){
throw (new Error(((("index " + _arg1) + " out of range ") + array.length)));
};
_local3 = array[_arg1];
array[_arg1] = _arg2;
return (_local3);
}
public function remove(_arg1:int){
if ((((_arg1 < 0)) || ((_arg1 >= array.length)))){
throw (new Error(((("index " + _arg1) + " out of range ") + (array.length - 1))));
};
return (array.splice(_arg1, 1)[0]);
}
public function g(_arg1:int){
if ((((_arg1 < 0)) || ((_arg1 >= array.length)))){
throw (new Error(((("index " + _arg1) + " out of range ") + array.length)));
};
return (array[_arg1]);
}
public function size():int{
return (array.length);
}
public function indexOf(_arg1, _arg2:int=0):int{
return (array.indexOf(_arg1, _arg2));
}
public function toString():String{
return (array.toString());
}
public function pop(){
return (array.pop());
}
public function getArrayCopy():Array{
var _local1:Array = new Array();
var _local2:int;
while (_local2 < size()) {
_local1[_local2] = g(_local2);
_local2++;
};
return (_local1);
}
public function lastIndexOf(_arg1, _arg2:int=2147483647):int{
return (array.lastIndexOf(_arg1, _arg2));
}
public function push(_arg1){
array.push(_arg1);
return (_arg1);
}
}
}//package util
Section 45
//TextFieldContainer (util.TextFieldContainer)
package util {
import flash.display.*;
public class TextFieldContainer extends Sprite {
public function TextFieldContainer(){
Translator.translateTextfields(this);
}
}
}//package util
Section 46
//TimeDisplay (util.TimeDisplay)
package util {
import flash.text.*;
public class TimeDisplay {
protected var digitTextFields:Array;
protected var ticksPerSecond:int;
protected var countDownSeconds:int;// = -1
public function TimeDisplay(_arg1:Array, _arg2:int){
this.digitTextFields = _arg1;
this.ticksPerSecond = _arg2;
}
public function update(_arg1:int):void{
var _local3:int;
var _local4:int;
var _local2:int = (_arg1 / ticksPerSecond);
if (_local2 != countDownSeconds){
countDownSeconds = _local2;
_local3 = (_local2 / 60);
_local2 = (_local2 % 60);
_local4 = (_local2 % 10);
TextField(digitTextFields[0]).text = ("" + _local4);
_local4 = (_local2 / 10);
TextField(digitTextFields[1]).text = ("" + _local4);
if (digitTextFields.length > 2){
_local4 = (_local3 % 10);
TextField(digitTextFields[2]).text = ("" + _local4);
};
if (digitTextFields.length > 3){
_local4 = (_local3 / 10);
TextField(digitTextFields[3]).text = ("" + _local4);
};
};
}
}
}//package util
Section 47
//Translator (util.Translator)
package util {
import amazingadventures.*;
import flash.display.*;
import flash.text.*;
public class Translator extends TextField {
public static function getTranslation(_arg1:String):String{
var name = _arg1;
return (String(Main.gameDataXml.text.(@id == name)));
}
public static function translateTextfields(_arg1:Sprite):void{
var _local3:TextField;
var _local2:int;
while (_local2 < _arg1.numChildren) {
if ((_arg1.getChildAt(_local2) is TextField)){
_local3 = TextField(_arg1.getChildAt(_local2));
Translator.translateTextfield(_local3);
} else {
if ((_arg1.getChildAt(_local2) is Sprite)){
Translator.translateTextfields(Sprite(_arg1.getChildAt(_local2)));
};
};
_local2++;
};
}
public static function translateTextfield(_arg1:TextField):void{
var translation:String;
var textField = _arg1;
translation = String(Main.gameDataXml.text.(@id == textField.name));
if (((!((translation == ""))) && (!((translation == null))))){
textField.text = translation;
};
}
}
}//package util
Section 48
//BonusSnd (BonusSnd)
package {
import flash.media.*;
public dynamic class BonusSnd extends Sound {
}
}//package
Section 49
//BottomBar (BottomBar)
package {
import flash.display.*;
public dynamic class BottomBar extends Sprite {
public var slideBar:SlideBar;
public var soundBtn:SoundBtn;
public var slideBar2:SlideBar2;
public var hintBtn:HintBtn;
public var musicBtn:MusicBtn;
public var exitBtn:ExitBtn;
}
}//package
Section 50
//btnSMEup (btnSMEup)
package {
import flash.display.*;
public dynamic class btnSMEup extends MovieClip {
}
}//package
Section 51
//ButtonClickSnd (ButtonClickSnd)
package {
import flash.media.*;
public dynamic class ButtonClickSnd extends Sound {
}
}//package
Section 52
//ButtonRollOverSnd (ButtonRollOverSnd)
package {
import flash.media.*;
public dynamic class ButtonRollOverSnd extends Sound {
}
}//package
Section 53
//Cheat (Cheat)
package {
import flash.display.*;
public dynamic class Cheat extends Sprite {
}
}//package
Section 54
//ExitBtn (ExitBtn)
package {
import flash.display.*;
public dynamic class ExitBtn extends MovieClip {
}
}//package
Section 55
//FoundSnd (FoundSnd)
package {
import flash.media.*;
public dynamic class FoundSnd extends Sound {
}
}//package
Section 56
//Hint1 (Hint1)
package {
import util.*;
public dynamic class Hint1 extends TextFieldContainer {
}
}//package
Section 57
//Hint2 (Hint2)
package {
import util.*;
public dynamic class Hint2 extends TextFieldContainer {
}
}//package
Section 58
//Hint3 (Hint3)
package {
import util.*;
public dynamic class Hint3 extends TextFieldContainer {
}
}//package
Section 59
//Hint4 (Hint4)
package {
import util.*;
public dynamic class Hint4 extends TextFieldContainer {
}
}//package
Section 60
//HintBtn (HintBtn)
package {
import flash.display.*;
public dynamic class HintBtn extends MovieClip {
}
}//package
Section 61
//HintSnd (HintSnd)
package {
import flash.media.*;
public dynamic class HintSnd extends Sound {
}
}//package
Section 62
//IntroBook (IntroBook)
package {
import flash.display.*;
import flash.text.*;
public dynamic class IntroBook extends Sprite {
public var countDownTf:TextField;
public var instruction_2_:TextField;
public var game_instructions_:TextField;
public var instruction_1_:TextField;
}
}//package
Section 63
//IntroLogo (IntroLogo)
package {
import flash.display.*;
public dynamic class IntroLogo extends Sprite {
}
}//package
Section 64
//IntroSnd (IntroSnd)
package {
import flash.media.*;
public dynamic class IntroSnd extends Sound {
}
}//package
Section 65
//KingLogo (KingLogo)
package {
import flash.display.*;
public dynamic class KingLogo extends Sprite {
}
}//package
Section 66
//LoopSnd (LoopSnd)
package {
import flash.media.*;
public dynamic class LoopSnd extends Sound {
}
}//package
Section 67
//MiddleBorder (MiddleBorder)
package {
import flash.display.*;
public dynamic class MiddleBorder extends Sprite {
}
}//package
Section 68
//MiniGameMatchSnd (MiniGameMatchSnd)
package {
import flash.media.*;
public dynamic class MiniGameMatchSnd extends Sound {
}
}//package
Section 69
//MusicBtn (MusicBtn)
package {
import flash.display.*;
public dynamic class MusicBtn extends MovieClip {
}
}//package
Section 70
//NotFoundSnd (NotFoundSnd)
package {
import flash.media.*;
public dynamic class NotFoundSnd extends Sound {
}
}//package
Section 71
//OutroScoreSnd (OutroScoreSnd)
package {
import flash.media.*;
public dynamic class OutroScoreSnd extends Sound {
}
}//package
Section 72
//PenaltySnd (PenaltySnd)
package {
import flash.media.*;
public dynamic class PenaltySnd extends Sound {
}
}//package
Section 73
//PopCapLogo (PopCapLogo)
package {
import flash.display.*;
public dynamic class PopCapLogo extends Sprite {
}
}//package
Section 74
//SlideBar (SlideBar)
package {
import flash.display.*;
public dynamic class SlideBar extends Sprite {
}
}//package
Section 75
//SlideBar2 (SlideBar2)
package {
import flash.display.*;
public dynamic class SlideBar2 extends Sprite {
}
}//package
Section 76
//SoundBtn (SoundBtn)
package {
import flash.display.*;
public dynamic class SoundBtn extends MovieClip {
}
}//package
Section 77
//TextItem (TextItem)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TextItem extends Sprite {
public var line:MovieClip;
public var textField:TextField;
}
}//package
Section 78
//TimeWarningSnd (TimeWarningSnd)
package {
import flash.media.*;
public dynamic class TimeWarningSnd extends Sound {
}
}//package
Section 79
//TopBar (TopBar)
package {
import flash.display.*;
import amazingadventures.client.*;
import flash.text.*;
public dynamic class TopBar extends Sprite {
public var scoreTf:TextField;
public var sceneNameTf:TextField;
public var relaxHintCountTf:TextField;
public var clock:Clock;
public var itemsLeftTf:TextField;
public var translatedTextFields:TranslatedTextFields;
}
}//package
Section 80
//TorchPillars (TorchPillars)
package {
import flash.display.*;
import amazingadventures.client.*;
public dynamic class TorchPillars extends Sprite {
public var torch1:TorchAnimation;
public var torch2:TorchAnimation;
public var torch3:TorchAnimation;
public var torch4:TorchAnimation;
}
}//package
Section 81
//TransBtn (TransBtn)
package {
import flash.display.*;
public dynamic class TransBtn extends MovieClip {
}
}//package
Section 82
//TranslatedTextFields (TranslatedTextFields)
package {
import util.*;
public dynamic class TranslatedTextFields extends TextFieldContainer {
}
}//package
Section 83
//Underline (Underline)
package {
import flash.display.*;
public dynamic class Underline extends Sprite {
}
}//package