Section 1
//allunlocked (sound.allunlocked)
package sound {
import flash.media.*;
public dynamic class allunlocked extends Sound {
}
}//package sound
Section 2
//badend (sound.badend)
package sound {
import flash.media.*;
public dynamic class badend extends Sound {
}
}//package sound
Section 3
//card (sound.card)
package sound {
import flash.media.*;
public dynamic class card extends Sound {
}
}//package sound
Section 4
//gamemusic (sound.gamemusic)
package sound {
import flash.media.*;
public dynamic class gamemusic extends Sound {
}
}//package sound
Section 5
//gameovermusic (sound.gameovermusic)
package sound {
import flash.media.*;
public dynamic class gameovermusic extends Sound {
}
}//package sound
Section 6
//goodend (sound.goodend)
package sound {
import flash.media.*;
public dynamic class goodend extends Sound {
}
}//package sound
Section 7
//severalcards (sound.severalcards)
package sound {
import flash.media.*;
public dynamic class severalcards extends Sound {
}
}//package sound
Section 8
//shuffle (sound.shuffle)
package sound {
import flash.media.*;
public dynamic class shuffle extends Sound {
}
}//package sound
Section 9
//timewarning (sound.timewarning)
package sound {
import flash.media.*;
public dynamic class timewarning extends Sound {
}
}//package sound
Section 10
//titlemusic (sound.titlemusic)
package sound {
import flash.media.*;
public dynamic class titlemusic extends Sound {
}
}//package sound
Section 11
//unlockLevel (sound.unlockLevel)
package sound {
import flash.media.*;
public dynamic class unlockLevel extends Sound {
}
}//package sound
Section 12
//Texture (src.globe.Texture)
package src.globe {
import flash.display.*;
public dynamic class Texture extends BitmapData {
public function Texture(_arg1:int=800, _arg2:int=400){
super(_arg1, _arg2);
}
}
}//package src.globe
Section 13
//Triangle (src.globe.Triangle)
package src.globe {
import flash.display.*;
import flash.geom.*;
public class Triangle extends Sprite {
public var v0:Vertex;
public var v1:Vertex;
public var v2:Vertex;
public function Triangle(_arg1:Vertex, _arg2:Vertex, _arg3:Vertex, _arg4:BitmapData){
this.v0 = _arg1;
this.v1 = _arg2;
this.v2 = _arg3;
var _local5:Matrix = new Matrix(1, 0, 0, 1, v0.x, v0.y);
_local5.a = (v1.x - v0.x);
_local5.b = (v1.y - v0.y);
_local5.c = (v2.x - v0.x);
_local5.d = (v2.y - v0.y);
_local5.invert();
graphics.clear();
graphics.beginBitmapFill(_arg4, _local5, true, true);
graphics.moveTo(0, 0);
graphics.lineTo(1.05, 0);
graphics.lineTo(0, 1.05);
graphics.endFill();
}
public function update(_arg1:Matrix):void{
var _local2:* = (((((v1.y - v0.y) / (v1.x - v0.x)) - ((v2.y - v0.y) / (v2.x - v0.x))))<0) ? 1 : 0;
var _local3:* = (((v0.x <= v1.x))==(v0.x > v2.x)) ? 1 : 0;
if ((_local2 ^ _local3) == 1){
visible = true;
_arg1.tx = v0.x;
_arg1.ty = v0.y;
_arg1.a = (v1.x - v0.x);
_arg1.b = (v1.y - v0.y);
_arg1.c = (v2.x - v0.x);
_arg1.d = (v2.y - v0.y);
transform.matrix = _arg1;
} else {
visible = false;
};
}
}
}//package src.globe
Section 14
//Vertex (src.globe.Vertex)
package src.globe {
public class Vertex {
public var x:Number;
public var y:Number;
public var px:Number;
public var py:Number;
public var pz:Number;
public function Vertex(_arg1:Number, _arg2:Number){
this.x = _arg1;
this.y = _arg2;
}
public function setCoordinates(_arg1:Number, _arg2:Number):void{
_arg1 = (_arg1 * (Math.PI * 2));
_arg2 = (_arg2 * Math.PI);
px = (Math.sin(_arg2) * Math.sin(_arg1));
py = -(Math.cos(_arg2));
pz = (Math.sin(_arg2) * Math.cos(_arg1));
}
public function rot(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number = ((px * _arg2) - (pz * _arg1));
var _local6:Number = py;
var _local7:Number = ((px * _arg1) + (pz * _arg2));
var _local8:Number = _local5;
var _local9:Number = ((_local6 * _arg4) + (_local7 * _arg3));
var _local10:Number = ((_local6 * _arg3) - (_local7 * _arg4));
_local10 = ((_local10 * 0.14) + 1);
x = ((_local8 / _local10) * 100);
y = ((_local9 / _local10) * 100);
}
}
}//package src.globe
Section 15
//BouncingCoin (src.intro.BouncingCoin)
package src.intro {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class BouncingCoin extends MovieClip {
private var TICKS_PER_SECOND:Number;// = 30
private var lastTime:Number;// = 0
public var coinAnim:MovieClip;
private var xp:Number;
private var yp:Number;
private var xa:Number;
private var ya:Number;
private var yt:Number;// = 0
public function BouncingCoin(){
xp = (yp = (xa = (ya = 0)));
xp = x;
yt = y;
y = (y - 550);
yp = y;
gotoAndStop(1);
}
public function startAnim():void{
lastTime = getTimer();
addEventListener(Event.ENTER_FRAME, advanceTime);
}
public function advanceTime(_arg1:Event):void{
var _local2:Number = getTimer();
while ((_local2 - lastTime) >= TICKS_PER_SECOND) {
lastTime = (lastTime + (1000 / TICKS_PER_SECOND));
xp = (xp + xa);
yp = (yp + ya);
ya = (ya + 0.8);
xa = (xa + 0);
if (yp >= yt){
yp = yt;
ya = ((-(ya) * 0.4) + 0.4);
if (ya > -1){
ya = 0;
};
};
};
var _local3:Number = ((_local2 - lastTime) / TICKS_PER_SECOND);
x = int(((xp + (xa * _local3)) - 0.5));
y = int(((yp + (ya * _local3)) - 0.5));
var _local4:int = ((int(((_local2 / 1000) * TICKS_PER_SECOND)) % 16) + 1);
coinAnim.gotoAndStop(_local4);
}
}
}//package src.intro
Section 16
//GlobeAnim (src.intro.GlobeAnim)
package src.intro {
import flash.display.*;
import src.globe.*;
import flash.geom.*;
import flash.utils.*;
public class GlobeAnim extends MovieClip {
private var currentContinent:int;// = -1
private var selectTime:Number;// = 0
private var continentMap:Array;
private var continentMap2:Array;
public var cloud0:MovieClip;
public var cloud1:MovieClip;
public var cloud2:MovieClip;
public var glow:MovieClip;
public var globeHolder:MovieClip;
public var texture:BitmapData;
public var nodes:Array;
public var triangles:Array;
public var xRotO:Number;
public var yRotO:Number;
public var xRot:Number;
public var yRot:Number;
public var xRotA:Number;
public var yRotA:Number;
public var lastTime:Number;
private var target:int;// = 0
private var remainingTime:Number;// = 0
private var rotStart:Number;// = 0
private var rotStartTime:Number;// = 0
public var positions:Array;
public function GlobeAnim(){
var _local4:int;
var _local5:Vertex;
var _local6:Vertex;
var _local7:Vertex;
var _local8:Vertex;
var _local9:Triangle;
var _local10:Triangle;
continentMap = [2, 0, 3, 1, 5, 4];
continentMap2 = [0, 4, 6, 3, 5, 1, 2];
nodes = new Array();
triangles = new Array();
positions = [[(Math.PI * 0.8), 0.3], [-2.7375, 0.1375], [-1.5, 0.6875], [-0.8, -0.4625], [-2.7125, 1.15], [1.4625, 0.9375], [2.125, -0.425]];
super();
texture = new Texture(400, 400);
var _local1 = 10;
var _local2 = 20;
var _local3:int;
while (_local3 < _local1) {
_local4 = 0;
while (_local4 < _local2) {
nodes[((_local3 * _local2) + _local4)] = new Vertex(((texture.width * _local4) / (_local2 - 1)), ((texture.height * _local3) / (_local1 - 1)));
nodes[((_local3 * _local2) + _local4)].setCoordinates((_local4 / (_local2 - 1)), (_local3 / (_local1 - 1)));
_local4++;
};
_local3++;
};
_local3 = 0;
while (_local3 < (_local1 - 1)) {
_local4 = 0;
while (_local4 < (_local2 - 1)) {
_local5 = nodes[(((_local3 + 0) * _local2) + (_local4 + 0))];
_local6 = nodes[(((_local3 + 0) * _local2) + (_local4 + 1))];
_local7 = nodes[(((_local3 + 1) * _local2) + (_local4 + 0))];
_local8 = nodes[(((_local3 + 1) * _local2) + (_local4 + 1))];
_local9 = new Triangle(_local5, _local6, _local8, texture);
triangles.push(_local9);
globeHolder.addChild(_local9);
_local10 = new Triangle(_local5, _local8, _local7, texture);
triangles.push(_local10);
globeHolder.addChild(_local10);
_local4++;
};
_local3++;
};
xRot = positions[target][0];
yRot = positions[target][1];
xRotA = 0;
yRotA = 0;
xRotO = -10000;
yRotO = -10000;
rotStartTime = getTimer();
}
private function tick():void{
var _local5:Number;
var _local1:Number = 0.5;
xRotO = xRot;
yRotO = yRot;
var _local2:Number = positions[target][0];
if (target == 0){
_local2 = (rotStart - (((((getTimer() - rotStartTime) % 10000) / 10000) * Math.PI) * 2));
} else {
rotStart = _local2;
rotStartTime = getTimer();
};
var _local3:Number = (_local2 - xRot);
var _local4:Number = (positions[target][1] - yRot);
while (_local3 < -(Math.PI)) {
_local3 = (_local3 + (Math.PI * 2));
};
while (_local3 >= Math.PI) {
_local3 = (_local3 - (Math.PI * 2));
};
xRotA = (xRotA * 0.8);
yRotA = (yRotA * 0.8);
if (((!((_local3 == 0))) || (!((_local4 == 0))))){
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local3 = (_local3 / _local5);
_local4 = (_local4 / _local5);
if (_local5 > _local1){
_local5 = _local1;
};
_local3 = (_local3 * (_local5 * 0.2));
_local4 = (_local4 * (_local5 * 0.2));
_local3 = (_local3 - xRotA);
_local4 = (_local4 - yRotA);
};
xRotA = (xRotA + _local3);
yRotA = (yRotA + _local4);
xRot = (xRot + xRotA);
yRot = (yRot + yRotA);
}
public function advanceTime(_arg1:int, _arg2:Number):Boolean{
var _local3:Number = (getTimer() / 50);
cloud0.rotation = ((_local3 * 1) + 313);
cloud1.rotation = ((-(_local3) * 0.85) + 281);
cloud2.rotation = ((_local3 * 0.9) + 428);
var _local4:Number = (1000 / 60);
remainingTime = (remainingTime + _arg2);
while (remainingTime > _local4) {
target = continentMap2[(_arg1 + 1)];
tick();
remainingTime = (remainingTime - _local4);
};
var _local5:Number = (remainingTime / _local4);
var _local6:Number = (xRot - xRotO);
var _local7:Number = (yRot - yRotO);
if (Math.sqrt(((_local6 * _local6) + (_local7 * _local7))) < 0.0001){
return (true);
};
updateTriangles((xRotO + (_local6 * _local5)), (yRotO + (_local7 * _local5)));
return (false);
}
public function lerp(_arg1:int, _arg2:Number):void{
var _local3:Number = positions[_arg1][0];
var _local4:Number = positions[_arg1][1];
_local3 = (_local3 - ((16 * (1 - _arg2)) * (1 - _arg2)));
_local4 = ((_local4 * _arg2) + (positions[0][1] * (1 - _arg2)));
updateTriangles(_local3, _local4);
}
public function updateTriangles(_arg1:Number, _arg2:Number):void{
var _local3:Number = Math.sin(_arg1);
var _local4:Number = Math.cos(_arg1);
var _local5:Number = Math.sin(_arg2);
var _local6:Number = Math.cos(_arg2);
var _local7:int;
while (_local7 < nodes.length) {
nodes[_local7].rot(_local3, _local4, _local5, _local6);
_local7++;
};
var _local8:Matrix = new Matrix(1, 0, 0, 1, 0, 0);
_local7 = 0;
while (_local7 < triangles.length) {
triangles[_local7].update(_local8);
_local7++;
};
}
}
}//package src.intro
Section 17
//Glowers (src.intro.Glowers)
package src.intro {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Glowers extends MovieClip {
public var glow0:MovieClip;
public var glow1:MovieClip;
public var glow2:MovieClip;
public var glow3:MovieClip;
public var glow4:MovieClip;
public var glow5:MovieClip;
public function Glowers(){
addEventListener(Event.ENTER_FRAME, animate);
}
public function animate(_arg1:Event):void{
var _local2:Number = ((getTimer() / 0x0400) * 3);
var _local3:Number = ((getTimer() / 1164) * -3);
var _local4:Number = ((getTimer() / 1424) * 3);
_local2 = (_local2 - (Math.sin((_local2 * 2)) * 0.2));
_local3 = (_local3 - (Math.sin((_local3 * 2)) * 0.2));
_local4 = (_local4 - (Math.sin((_local4 * 2)) * 0.2));
glow0.x = (Math.sin(_local2) * 90);
glow2.x = (Math.sin(_local3) * 166);
glow4.x = (Math.sin(_local4) * 217);
glow0.y = (Math.cos(_local2) * 112);
glow2.y = (Math.cos(_local3) * 112);
glow4.y = (Math.cos(_local4) * 112);
var _local5:Number = (glow0.y / 112);
var _local6:Number = (glow2.y / 112);
var _local7:Number = (glow4.y / 112);
_local5 = (1 - ((_local5 * _local5) * 0.7));
_local6 = (1 - ((_local6 * _local6) * 0.7));
_local7 = (1 - ((_local7 * _local7) * 0.7));
glow0.scaleX = (glow0.scaleY = (glow1.scaleX = (glow1.scaleY = _local5)));
glow2.scaleX = (glow2.scaleY = (glow3.scaleX = (glow3.scaleY = _local6)));
glow4.scaleX = (glow4.scaleY = (glow5.scaleX = (glow5.scaleY = _local7)));
glow1.x = -(glow0.x);
glow1.y = -(glow0.y);
glow3.x = -(glow2.x);
glow3.y = -(glow2.y);
glow5.x = -(glow4.x);
glow5.y = -(glow4.y);
}
}
}//package src.intro
Section 18
//Hoverer (src.intro.Hoverer)
package src.intro {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Hoverer {
public var hovered:Boolean;
public var hoverLevel:Number;// = 0
private var intro:Intro;
private var source:MovieClip;
private var target:MovieClip;
private var orgRot:Number;
private var wobbleTime:Number;
private var wobbleOffset:Number;
public function Hoverer(_arg1:Intro, _arg2:int, _arg3:MovieClip, _arg4:MovieClip){
this.intro = _arg1;
this.source = _arg3;
this.target = _arg4;
this.orgRot = _arg3.rotation;
wobbleOffset = ((Math.random() * Math.PI) * 2);
wobbleTime = (((Math.random() + Math.random()) * 100) + 400);
_arg3.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
_arg3.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
_arg3.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
}
public function mouseDown(_arg1:MouseEvent):void{
intro.cardClicked(true);
}
public function mouseOver(_arg1:MouseEvent):void{
hovered = true;
}
public function mouseOut(_arg1:MouseEvent):void{
hovered = false;
}
public function advanceTime(_arg1:Boolean, _arg2:Number):void{
var _local3:Number = hoverLevel;
_arg2 = ((_arg2 * 10) / 1000);
if (_arg1){
hoverLevel = (hoverLevel + _arg2);
} else {
hoverLevel = (hoverLevel - _arg2);
};
if (hoverLevel <= 0){
hoverLevel = 0;
};
if (hoverLevel >= 1){
hoverLevel = 1;
};
source.rotation = (orgRot + (Math.sin(((getTimer() / wobbleTime) + wobbleOffset)) * 5));
target.rotation = (source.rotation * (1 - (hoverLevel * 0.5)));
if (_local3 == hoverLevel){
return;
};
if ((((_local3 == 0)) || ((hoverLevel == 0)))){
source.alpha = ((hoverLevel == 0)) ? 1 : 0;
target.alpha = ((hoverLevel)!=0) ? 1 : 0;
};
var _local4:Number = Math.sqrt(hoverLevel);
target.scaleX = (1 + (_local4 * 0.35));
target.scaleY = (1 + (_local4 * 0.35));
}
}
}//package src.intro
Section 19
//Instructions (src.intro.Instructions)
package src.intro {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class Instructions extends MovieClip {
public var bodyText1:TextField;
public var bodyText2:TextField;
public function rollOver(_arg1:MouseEvent):void{
}
public function rollOut(_arg1:MouseEvent):void{
}
public function click(_arg1:MouseEvent):void{
visible = false;
}
}
}//package src.intro
Section 20
//Intro (src.intro.Intro)
package src.intro {
import flash.display.*;
import src.*;
import flash.events.*;
import flash.geom.*;
import src.util.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
public class Intro extends MovieClip {
public var continentChooser:MovieClip;
public var selectHighlight:MovieClip;
public var fireworks0:MovieClip;
public var fireworks1:MovieClip;
public var sun:MovieClip;
public var logo:MovieClip;
public var globeAnim:GlobeAnim;
public var textHolder:MovieClip;
public var instructions:Instructions;
private var continents:Array;
private var selectedContinents:Array;
private var hoverers:Array;
private var locks:Array;
private var lastTime:int;
private var startTime:int;
private var fireworksTime:int;
private var selectedContinent:int;
private var unlocked:int;// = 0
private var mousePressed:Boolean;// = false
private var gameArea:GameArea;
public var frontCoin:MovieClip;
public var backCoin:MovieClip;
public var gameStartsInText:TextField;
private var gameScreenBitmap:Bitmap;
private var globeBitmap:Bitmap;
private var introStartTime:int;
private var mayClickCard:Boolean;// = false
private static var DURATION:int = 25000;
private static var FIREWORKS_INTERVAL:int = 80;
public static var CONTINENT_NAME_MAP:Array = ["continent_europe", "continent_south_america", "continent_australia", "continent_north_america", "continent_africa", "continent_asia"];
public function Intro(_arg1:GameArea, _arg2:int, _arg3:int){
continents = new Array();
selectedContinents = new Array();
hoverers = new Array();
locks = new Array();
super();
this.gameArea = _arg1;
continents.push(continentChooser.continent0);
continents.push(continentChooser.continent1);
continents.push(continentChooser.continent2);
continents.push(continentChooser.continent3);
continents.push(continentChooser.continent4);
continents.push(continentChooser.continent5);
selectedContinents.push(selectHighlight.continent0);
selectedContinents.push(selectHighlight.continent1);
selectedContinents.push(selectHighlight.continent2);
selectedContinents.push(selectHighlight.continent3);
selectedContinents.push(selectHighlight.continent4);
selectedContinents.push(selectHighlight.continent5);
selectHighlight.lock0.visible = false;
selectHighlight.lock1.visible = false;
selectHighlight.lock2.visible = false;
selectHighlight.lock3.visible = false;
selectHighlight.lock4.visible = false;
selectHighlight.lock5.visible = false;
locks.push(continentChooser.lock0);
locks.push(continentChooser.lock1);
locks.push(continentChooser.lock2);
locks.push(continentChooser.lock3);
locks.push(continentChooser.lock4);
locks.push(continentChooser.lock5);
selectHighlight.mouseEnabled = false;
selectHighlight.mouseChildren = false;
startTime = (lastTime = (fireworksTime = getTimer()));
addEventListener(Event.ENTER_FRAME, tickIntro);
setUnlocked(_arg2, _arg3);
frontCoin.visible = (backCoin.visible = false);
instructions.bodyText1.text = TextMappings.get("instructions1");
instructions.bodyText2.text = TextMappings.get("instructions2");
if (_arg1.gdp.playerType == "money"){
textHolder.selectContinentText.text = TextMappings.get("select_continent");
} else {
if (_arg1.gdp.playerType == "money_no_save"){
textHolder.selectContinentText.text = TextMappings.get("select_continent_no_save");
} else {
textHolder.selectContinentText.text = TextMappings.get("select_continent_nag");
};
};
textHolder.visible = false;
addEventListener(MouseEvent.MOUSE_DOWN, pressButton);
tickIntro(null);
introStartTime = getTimer();
useHandCursor = true;
buttonMode = true;
instructions.mouseEnabled = false;
instructions.bodyText1.mouseEnabled = false;
instructions.bodyText2.mouseEnabled = false;
gameStartsInText.mouseEnabled = false;
globeAnim.useHandCursor = true;
globeAnim.buttonMode = true;
globeAnim.addEventListener(MouseEvent.MOUSE_DOWN, globeClicked);
}
public function globeClicked(_arg1:MouseEvent):void{
cardClicked(false);
}
public function pressButton(_arg1:MouseEvent):void{
mousePressed = true;
}
private function setUnlocked(_arg1:int, _arg2:int):void{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:ColorMatrixFilter;
var _local10:Array;
if (_arg1 >= 6){
textHolder.toUnlockText.text = TextMappings.get("all_unlocked");
} else {
_local4 = TextMappings.get(CONTINENT_NAME_MAP[_arg1]);
if (_arg2 == 1){
textHolder.toUnlockText.text = TextMappings.get("unlock_next_in_singular").split("[0]").join(_local4);
} else {
textHolder.toUnlockText.text = TextMappings.get("unlock_next_in").split("[0]").join(_arg2).split("[1]").join(_local4);
};
};
this.unlocked = _arg1;
var _local3:int;
while (_local3 < 6) {
if (_local3 < _arg1){
selectedContinents[_local3].alpha = 0;
selectedContinents[_local3].mouseEnabled = false;
continents[_local3].useHandCursor = true;
continents[_local3].buttonMode = true;
hoverers.push(new Hoverer(this, _local3, continents[_local3], selectedContinents[_local3]));
locks[_local3].visible = false;
} else {
selectedContinents[_local3].visible = false;
_local5 = new Array();
_local6 = (0.3 * 0.6);
_local7 = (0.59 * 0.6);
_local8 = (0.11 * 0.6);
_local5 = _local5.concat([_local6, _local7, _local8, 0, 0]);
_local5 = _local5.concat([_local6, _local7, _local8, 0, 0]);
_local5 = _local5.concat([_local6, _local7, _local8, 0, 0]);
_local5 = _local5.concat([0, 0, 0, 1, 0]);
_local9 = new ColorMatrixFilter(_local5);
_local10 = new Array();
_local10.push(_local9);
continents[_local3].filters = _local10;
};
_local3++;
};
}
public function cardClicked(_arg1:Boolean):void{
if (!mayClickCard){
return;
};
if (instructions.visible){
return;
};
mayClickCard = false;
if (_arg1){
gameArea.effectSound.get("card").play();
};
var _local2 = -1;
var _local3:int;
while (_local3 < unlocked) {
if (hoverers[_local3].hovered){
_local2 = _local3;
};
_local3++;
};
if (_local2 == -1){
_local2 = int((Math.random() * unlocked));
};
this.selectedContinent = _local2;
removeEventListener(Event.ENTER_FRAME, tickSelectContinent);
startTime = getTimer();
gameArea.musicSound.get("titlemusic").fadeTo(0, 2000);
addEventListener(Event.ENTER_FRAME, tickOutro);
var _local4:Array = [3, 5, 2, 4, 0, 1];
gameScreenBitmap = new Bitmap(gameArea.getBitmap(_local4[selectedContinent]));
continentChooser.visible = false;
selectHighlight.visible = false;
instructions.visible = false;
textHolder.visible = false;
logo.visible = false;
gameStartsInText.visible = false;
frontCoin.visible = (backCoin.visible = false);
}
public function tickOutro(_arg1:Event):void{
var _local9:BitmapData;
var _local10:Array;
stage.quality = "medium";
var _local2:int = getTimer();
var _local3:Number = (_local2 - lastTime);
lastTime = _local2;
var _local4:Boolean = globeAnim.advanceTime(selectedContinent, _local3);
if (!_local4){
startTime = getTimer();
return;
};
if (globeBitmap == null){
_local9 = new BitmapData(250, 250, true, 0);
_local9.draw(globeAnim, new Matrix(1, 0, 0, 1, 128, 128));
globeBitmap = new Bitmap(_local9);
globeBitmap.smoothing = true;
addChild(globeBitmap);
addChild(gameScreenBitmap);
gameScreenBitmap.alpha = 0;
};
var _local5:Number = (_local2 - startTime);
var _local6:Number = (_local5 / 500);
var _local7:Number = (1 / (1 - (_local6 * 0.32)));
if (_local7 < 0){
_local7 = 0;
};
globeBitmap.x = (globeAnim.x - (128 * _local7));
globeBitmap.y = (globeAnim.y - (128 * _local7));
globeBitmap.scaleX = (globeBitmap.scaleY = _local7);
var _local8:Number = ((_local5 - 1000) / 500);
if (_local8 < 0){
_local8 = 0;
};
gameScreenBitmap.alpha = (_local8 * _local8);
if (_local5 > 1500){
stage.quality = "high";
removeEventListener(Event.ENTER_FRAME, tickOutro);
_local10 = [3, 5, 2, 4, 0, 1];
gameArea.startGame(_local10[selectedContinent], selectedContinent);
};
}
public function tickIntro(_arg1:Event):void{
var _local6:int;
continentChooser.visible = false;
selectHighlight.visible = false;
instructions.visible = false;
var _local2:int = getTimer();
globeAnim.advanceTime(-1, (_local2 - lastTime));
lastTime = _local2;
var _local3:Number = (_local2 - startTime);
if (mousePressed){
if (_local3 < 2100){
_local6 = (2100 - _local3);
startTime = (startTime - _local6);
} else {
if (_local3 < 15000){
_local6 = (15000 - _local3);
startTime = (startTime - _local6);
};
};
mousePressed = false;
};
var _local4:Number = (4000 - _local3);
if (_local4 < 0){
_local4 = 0;
};
var _local5:Number = ((_local3 - 1600) / 500);
if (_local5 < 0){
_local5 = 0;
};
if (_local5 > 1){
_local5 = 1;
};
logo.scaleX = (logo.scaleY = (Math.cos(((_local5 * Math.PI) / 2)) + 1));
logo.y = (61.9 + (140 * Math.cos(((_local5 * Math.PI) / 2))));
instructions.visible = (_local5 == 1);
globeAnim.scaleX = (globeAnim.scaleY = 0);
tickIntroTimer();
if (_local3 > 15000){
useHandCursor = false;
buttonMode = false;
instructions.visible = false;
continentChooser.visible = true;
selectHighlight.visible = true;
removeEventListener(Event.ENTER_FRAME, tickIntro);
addEventListener(Event.ENTER_FRAME, tickSelectContinent);
textHolder.visible = true;
startTime = getTimer();
tickSelectContinent(_arg1);
};
}
public function tickIntroTimer():void{
var _local1:Number = (getTimer() - introStartTime);
var _local2:int = ((DURATION - _local1) / 1000);
gameStartsInText.text = TextMappings.get("game_starts_in").split("[0]").join(_local2);
if (_local2 == 0){
cardClicked(false);
};
var _local3:Number = ((_local1 / DURATION) * Math.PI);
var _local4:Number = (Math.cos(_local3) * Math.sin((Math.PI * 0.7)));
var _local5:Number = Math.sin(_local3);
var _local6:Number = (Math.cos(_local3) * Math.cos((Math.PI * 0.7)));
var _local7:Number = ((_local5 * 1) + 4);
sun.x = (globeAnim.x - (((_local4 * 550) / _local7) * 4));
sun.y = (globeAnim.y - (((_local6 * 550) / _local7) * 4));
sun.scaleX = (sun.scaleY = (4 / _local7));
sun.visible = (_local7 > 4);
globeAnim.glow.x = ((-(_local4) * 6) - 100);
globeAnim.glow.y = ((-(_local6) * 6) - 100);
}
public function tickSelectContinent(_arg1:Event):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:int;
var _local2:int = getTimer();
var _local3:Number = (_local2 - startTime);
var _local4:Number = ((1000 - _local3) * 2);
if (_local4 < 0){
_local4 = 0;
mayClickCard = true;
};
var _local5:Number = ((1 - ((_local4 * _local4) / 2000000)) + (_local4 / 3000));
if (_local5 < 0){
_local5 = 0;
};
globeAnim.scaleX = (globeAnim.scaleY = _local5);
var _local6:Number = (_local2 - lastTime);
if (unlocked >= 6){
spawnFireworks(_local2);
_local8 = (getTimer() / 1000);
_local9 = (getTimer() / 9000);
_local10 = (Math.sin(_local8) * Math.sin(_local9));
_local11 = Math.cos(_local8);
_local12 = (Math.sin(_local8) * Math.cos(_local9));
_local13 = ((_local11 * 1) + 2);
frontCoin.x = (backCoin.x = (globeAnim.x + ((_local10 * 250) / _local13)));
frontCoin.y = (backCoin.y = (globeAnim.y + ((_local12 * 250) / _local13)));
frontCoin.scaleX = (backCoin.scaleX = (frontCoin.scaleY = (backCoin.scaleY = (1 / _local13))));
frontCoin.visible = !((backCoin.visible = (_local11 > 0)));
backCoin.rotation = (frontCoin.rotation = (((-(_local9) * 180) / Math.PI) - 90));
_local14 = ((int((_local8 * 30)) % 16) + 1);
backCoin.coinAnim.gotoAndStop(_local14);
frontCoin.coinAnim.gotoAndStop(_local14);
};
var _local7 = -1;
if (!instructions.visible){
_local15 = 0;
while (_local15 < unlocked) {
if (hoverers[_local15].hovered){
_local7 = _local15;
};
_local15++;
};
};
if (_local7 == -1){
if (gameArea.gdp.playerType == "money"){
textHolder.selectContinentText.text = TextMappings.get("select_continent");
} else {
if (gameArea.gdp.playerType == "money_no_save"){
textHolder.selectContinentText.text = TextMappings.get("select_continent_no_save");
} else {
textHolder.selectContinentText.text = TextMappings.get("select_continent_nag");
};
};
} else {
textHolder.selectContinentText.text = TextMappings.get(CONTINENT_NAME_MAP[_local7]);
};
_local15 = 0;
while (_local15 < unlocked) {
hoverers[_local15].advanceTime((_local15 == _local7), _local6);
_local15++;
};
globeAnim.advanceTime(_local7, _local6);
lastTime = _local2;
tickIntroTimer();
}
public function spawnFireworks(_arg1:int):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Fireworks;
while ((_arg1 - fireworksTime) > FIREWORKS_INTERVAL) {
fireworksTime = (fireworksTime + FIREWORKS_INTERVAL);
_local2 = ((Math.random() * 2) - 1);
_local3 = ((Math.random() * 2) - 1);
_local4 = ((Math.random() * 2) - 1);
if ((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4)) < 1){
_local5 = Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4)));
_local2 = (_local2 / _local5);
_local3 = (_local3 / _local5);
_local4 = (_local4 / _local5);
_local2 = ((_local2 * 120) + globeAnim.x);
_local3 = ((_local3 * 120) + globeAnim.y);
_local6 = new Fireworks(_local2, _local3, ((1 / ((_local4 * 0.3) + 1)) * 0.5));
if (_local4 < 0){
fireworks0.addChild(_local6);
} else {
fireworks1.addChild(_local6);
};
};
};
}
}
}//package src.intro
Section 21
//ManagedSound (src.sound.ManagedSound)
package src.sound {
import flash.media.*;
public class ManagedSound {
private var ClassReference:Class;
public var activeSounds:Array;
private var manager:SoundManager;
public function ManagedSound(_arg1:SoundManager, _arg2:Class){
activeSounds = new Array();
super();
this.manager = _arg1;
this.ClassReference = _arg2;
}
public function play(_arg1:Number=1, _arg2:Number=0):ManagedSoundChannel{
var _local3:SoundChannel = new ClassReference().play(0, 0, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local3));
}
public function loop(_arg1:Number=1, _arg2:Number=0):ManagedSoundChannel{
var _local3:SoundChannel = new ClassReference().play(0, 999999999, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local3));
}
public function stop():void{
var _local1:int;
while (_local1 < activeSounds.length) {
activeSounds[_local1].stop();
_local1++;
};
}
public function setPan(_arg1:Number):void{
var _local2:int;
while (_local2 < activeSounds.length) {
activeSounds[_local2].setPan(_arg1);
_local2++;
};
}
public function setVolume(_arg1:Number):void{
var _local2:int;
while (_local2 < activeSounds.length) {
activeSounds[_local2].setVolume(_arg1);
_local2++;
};
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].fadeTo(_arg1, _arg2);
_local3++;
};
}
public function fadeToAndStop(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].fadeToAndStop(_arg1, _arg2);
_local3++;
};
}
public function panTo(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].panTo(_arg1, _arg2);
_local3++;
};
}
public function isPlaying():Boolean{
return ((activeSounds.length > 0));
}
public function update():void{
var _local1:int;
while (_local1 < activeSounds.length) {
activeSounds[_local1].update();
_local1++;
};
}
}
}//package src.sound
Section 22
//ManagedSoundChannel (src.sound.ManagedSoundChannel)
package src.sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class ManagedSoundChannel {
private var sound:ManagedSound;
private var channel:SoundChannel;
private var manager:SoundManager;
private var targetVolume:Number;
private var targetPan:Number;
private var fadeStartTime:Number;// = -1
private var fadeEndTime:Number;// = -1
private var fadeStartVolume:Number;// = -1
private var fadeEndVolume:Number;// = -1
private var panStartTime:Number;// = -1
private var panEndTime:Number;// = -1
private var panStartVolume:Number;// = -1
private var panEndVolume:Number;// = -1
private var stopAfterFade:Boolean;// = false
private var playing:Boolean;// = true
public function ManagedSoundChannel(_arg1:SoundManager, _arg2:ManagedSound, _arg3:SoundChannel){
this.manager = _arg1;
this.sound = _arg2;
this.channel = _arg3;
_arg2.activeSounds.push(this);
if (_arg3 == null){
soundComplete(null);
return;
};
_arg3.addEventListener(Event.SOUND_COMPLETE, soundComplete);
targetVolume = _arg3.soundTransform.volume;
targetPan = _arg3.soundTransform.pan;
update();
}
public function soundComplete(_arg1:Event):void{
if (!playing){
return;
};
sound.activeSounds.splice(sound.activeSounds.indexOf(this), 1);
playing = false;
}
public function setPan(_arg1:Number):void{
if (!playing){
return;
};
if (channel == null){
return;
};
channel.soundTransform.pan = _arg1;
panStartTime = -1;
update();
}
public function setVolume(_arg1:Number):void{
if (!playing){
return;
};
stopAfterFade = false;
this.targetVolume = _arg1;
fadeStartTime = -1;
update();
}
public function stop():void{
if (!playing){
return;
};
if (channel == null){
return;
};
channel.stop();
soundComplete(null);
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
fadeStartVolume = Math.sqrt(targetVolume);
fadeEndVolume = Math.sqrt(_arg1);
fadeStartTime = getTimer();
fadeEndTime = (getTimer() + _arg2);
stopAfterFade = false;
}
public function fadeToAndStop(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
fadeTo(_arg1, _arg2);
stopAfterFade = true;
}
public function panTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
panStartVolume = targetPan;
panEndVolume = _arg1;
panStartTime = getTimer();
panEndTime = (getTimer() + _arg2);
}
public function update():void{
var _local1:Number;
if (!playing){
return;
};
if (fadeStartTime >= 0){
_local1 = ((getTimer() - fadeStartTime) / (fadeEndTime - fadeStartTime));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
targetVolume = (fadeStartVolume + ((fadeEndVolume - fadeStartVolume) * _local1));
targetVolume = (targetVolume * targetVolume);
if (_local1 == 1){
fadeStartTime = -1;
};
if ((((_local1 == 1)) && (stopAfterFade))){
stop();
};
};
if (panStartTime >= 0){
_local1 = ((getTimer() - panStartTime) / (panEndTime - panStartTime));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
targetPan = (panStartVolume + ((panEndVolume - panStartVolume) * _local1));
if (_local1 == 1){
panStartTime = -1;
};
};
var _local2:Number = (targetVolume * manager.volume);
var _local3:Number = targetPan;
if (channel == null){
return;
};
if (((!((_local2 == channel.soundTransform.volume))) || (!((_local3 == channel.soundTransform.pan))))){
channel.soundTransform = new SoundTransform(_local2, _local3);
};
}
public function isPlaying():Boolean{
return (playing);
}
}
}//package src.sound
Section 23
//SoundManager (src.sound.SoundManager)
package src.sound {
import flash.utils.*;
public class SoundManager {
private var managedSoundMap:Object;
private var managedSounds:Array;
private var lastTime:Number;// = -1
public var volume:Number;// = 1
private var fadeStartTime:Number;// = -1
private var fadeEndTime:Number;// = -1
private var fadeStartVolume:Number;// = -1
private var fadeEndVolume:Number;// = -1
public function SoundManager(){
managedSoundMap = new Object();
managedSounds = new Array();
super();
}
public function get(_arg1:String):ManagedSound{
var _local2:Class;
if (managedSoundMap[_arg1] == null){
_local2 = (getDefinitionByName(("sound." + _arg1)) as Class);
if (_local2 == null){
throw (new Error(("Failed to find sound " + _arg1)));
};
managedSoundMap[_arg1] = new ManagedSound(this, _local2);
managedSounds.push(managedSoundMap[_arg1]);
};
return (managedSoundMap[_arg1]);
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
fadeStartVolume = Math.sqrt(volume);
fadeEndVolume = Math.sqrt(_arg1);
fadeStartTime = getTimer();
fadeEndTime = (getTimer() + _arg2);
}
public function setVolume(_arg1:Number):void{
this.volume = _arg1;
fadeStartTime = -1;
}
public function stopAll():void{
var _local1:int;
while (_local1 < managedSounds.length) {
managedSounds[_local1].stop();
_local1++;
};
}
public function update():void{
var _local3:Number;
var _local1:Number = getTimer();
if (lastTime < 0){
lastTime = _local1;
};
if (fadeStartTime >= 0){
_local3 = ((getTimer() - fadeStartTime) / (fadeEndTime - fadeStartTime));
if (_local3 < 0){
_local3 = 0;
};
if (_local3 > 1){
_local3 = 1;
};
volume = (fadeStartVolume + ((fadeEndVolume - fadeStartVolume) * _local3));
volume = (volume * volume);
if (_local3 == 1){
fadeStartTime = -1;
};
};
var _local2:int;
while (_local2 < managedSounds.length) {
managedSounds[_local2].update();
_local2++;
};
}
}
}//package src.sound
Section 24
//GameDataParser (src.util.GameDataParser)
package src.util {
import flash.xml.*;
public class GameDataParser {
public var textMappings:Object;
public var randomSeed:int;
public var gameType:String;
public var cardList:String;
public var playerType:String;
public var gameMode:String;
public var relaxMode:Boolean;
public var unlocked:int;// = 1
public var remaining:int;// = 999
public var timeLimit:int;// = 600
public function parse(_arg1:String):void{
var _local2:XMLDocument = new XMLDocument(_arg1);
textMappings = new Object();
var _local3:Array = _local2.firstChild.childNodes;
randomSeed = parseInt(_local2.firstChild.attributes.randomseed);
cardList = new String(_local2.firstChild.attributes.cards);
playerType = new String(_local2.firstChild.attributes.playerType);
gameMode = new String(_local2.firstChild.attributes.mode);
timeLimit = parseInt(_local2.firstChild.attributes.timelimit);
relaxMode = (new String(_local2.firstChild.attributes.relaxMode) == "true");
var _local4:int;
while (_local4 < _local3.length) {
if (_local3[_local4].nodeName == "id"){
};
if (_local3[_local4].nodeName == "unlocked"){
unlocked = parseInt(_local3[_local4].firstChild.nodeValue);
};
if (_local3[_local4].nodeName == "remaining"){
remaining = parseInt(_local3[_local4].firstChild.nodeValue);
};
if (_local3[_local4].nodeName == "game"){
gameType = new String(_local3[_local4].attributes.type);
};
if (_local3[_local4].nodeName == "text"){
if ((((_local3[_local4].firstChild == null)) || ((_local3[_local4].firstChild == undefined)))){
textMappings[_local3[_local4].attributes.id] = (("[xx" + _local3[_local4].attributes.id) + "xx]");
} else {
textMappings[_local3[_local4].attributes.id] = new String(_local3[_local4].firstChild.nodeValue);
};
TextMappings.set(_local3[_local4].attributes.id, textMappings[_local3[_local4].attributes.id]);
};
_local4++;
};
}
}
}//package src.util
Section 25
//TextMappings (src.util.TextMappings)
package src.util {
public class TextMappings {
public static var mappings:Object = new Object();
public static function get(_arg1:String):String{
if (mappings[_arg1] == undefined){
return ((("[" + _arg1) + "]"));
};
return (mappings[_arg1]);
}
public static function set(_arg1:String, _arg2:String):void{
mappings[_arg1] = _arg2;
}
}
}//package src.util
Section 26
//Card (src.Card)
package src {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Card extends MovieClip {
private var DOUBLE_CLICK_DISTANCE:Number;// = 16
private var DOUBLE_CLICK_TIME:int;// = 500
public var suit:int;
public var value:int;
private var continent:int;
private var revealed:Boolean;// = false
private var m_hasBeenInFoundation:Boolean;// = false
private var isClickable:Boolean;// = false
public var pile:Pile;
public var pos:int;
private var xDragStart:int;
private var yDragStart:int;
private var xLastClick:int;
private var yLastClick:int;
private var lastClickTime:int;// = -1
private var suitImageMap:Array;
private var hasStageListeners:Boolean;// = false
private var xSlideFrom:Number;
private var ySlideFrom:Number;
public static var maybeDragCard:Card = null;
public static var lastClickCard:Card = null;
public function Card(_arg1:int, _arg2:int, _arg3:int){
suitImageMap = [0, 1, 3, 2];
super();
this.suit = _arg1;
this.value = _arg2;
this.continent = _arg3;
gotoAndStop((revealed) ? (((suitImageMap[_arg1] * 13) + _arg2) + 1) : (60 + _arg3));
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
buttonMode = true;
doubleClickEnabled = true;
setClickable(false);
}
public function setClickable(_arg1:Boolean):void{
this.isClickable = _arg1;
useHandCursor = _arg1;
}
public function doubleClick(_arg1:MouseEvent):void{
if (((isClickable) && (!((pile == null))))){
pile.doubleClickCard(this);
};
}
public function mouseUp(_arg1:MouseEvent):void{
Card.maybeDragCard = null;
}
public function mouseMove(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
if (((((isClickable) && (!((pile == null))))) && ((Card.maybeDragCard == this)))){
_local2 = (mouseX - xDragStart);
_local3 = (mouseY - yDragStart);
if (((_local2 * _local2) + (_local3 * _local3)) > DOUBLE_CLICK_DISTANCE){
pile.pressCard(this, xDragStart, yDragStart);
};
};
}
public function mouseDown(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Number;
var _local4:Number;
if (!hasStageListeners){
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
hasStageListeners = true;
};
if (((isClickable) && (!((pile == null))))){
if (pile.name == "h0"){
pile.pressCard(this, xDragStart, yDragStart);
return;
};
_local2 = (getTimer() - lastClickTime);
_local3 = (mouseX - xLastClick);
_local4 = (mouseY - yLastClick);
if ((((((((_local3 * _local3) + (_local4 * _local4)) <= DOUBLE_CLICK_DISTANCE)) && ((_local2 < DOUBLE_CLICK_TIME)))) && ((Card.lastClickCard == this)))){
doubleClick(_arg1);
return;
};
Card.lastClickCard = this;
xLastClick = mouseX;
yLastClick = mouseY;
Card.maybeDragCard = this;
xDragStart = mouseX;
yDragStart = mouseY;
lastClickTime = getTimer();
};
}
public function getSuit():int{
return (suit);
}
public function getValue():int{
return (value);
}
public function isRevealed():Boolean{
return (revealed);
}
public function reveal():void{
revealed = true;
gotoAndStop((revealed) ? (((suitImageMap[suit] * 13) + value) + 1) : (60 + continent));
}
public function hide():void{
revealed = false;
gotoAndStop((revealed) ? (((suitImageMap[suit] * 13) + value) + 1) : (60 + continent));
}
public function hasBeenInFoundation():Boolean{
return (m_hasBeenInFoundation);
}
public function setHasBeenInFoundation(_arg1:Boolean):void{
this.m_hasBeenInFoundation = _arg1;
}
public function prepareSlide():void{
xSlideFrom = x;
ySlideFrom = y;
}
public function slide(_arg1:KlondikeRules):void{
_arg1.slide(this, xSlideFrom, ySlideFrom, x, y);
}
}
}//package src
Section 27
//ColumnPile (src.ColumnPile)
package src {
import flash.display.*;
public class ColumnPile extends Pile {
private var hiddenCards:int;// = 0
public function ColumnPile(_arg1:MovieClip, _arg2:KlondikeRules, _arg3:String){
super(_arg1, _arg2, _arg3);
}
override public function mayPushCards(_arg1:Array):Boolean{
var _local3:Card;
var _local2:Card = _arg1[0];
if (getCardCount() > 0){
_local3 = getTopCard();
if ((_local2.getSuit() & 1) == (_local3.getSuit() & 1)){
return (false);
};
if (_local2.getValue() != (_local3.getValue() - 1)){
return (false);
};
} else {
if (_local2.getValue() != 12){
return (false);
};
};
return (true);
}
override public function doubleClickCard(_arg1:Card):void{
if (_arg1 == getTopCard()){
tryClickToFoundation(_arg1);
};
}
override public function popCard():Card{
var _local1:Card = super.popCard();
var _local2:Card = super.getTopCard();
if (_local2 != null){
_local2.setClickable(true);
};
return (_local1);
}
override public function pushCard(_arg1:Card):void{
var _local2:Card = super.getTopCard();
if (((!((_local2 == null))) && (!(_local2.isRevealed())))){
_local2.setClickable(false);
};
super.pushCard(_arg1);
_arg1.setClickable(_arg1.isRevealed());
}
public function countHidden():void{
hiddenCards = 0;
var _local1:int;
while (_local1 < cards.length) {
if (!cards[_local1].isRevealed()){
hiddenCards++;
};
_local1++;
};
}
override public function placeCard(_arg1:Card, _arg2:int):void{
countHidden();
_arg1.x = mc.x;
if (_arg2 <= hiddenCards){
_arg1.y = (mc.y + (_arg2 * 4));
} else {
_arg1.y = ((mc.y + (hiddenCards * 4)) + ((_arg2 - hiddenCards) * 15));
};
}
override public function revealTopCard():void{
super.revealTopCard();
rules.increaseScore(20);
getTopCard().setClickable(true);
}
override public function pressCard(_arg1:Card, _arg2:int, _arg3:int):void{
var _local4:int;
if (!_arg1.isRevealed()){
rules.reveal(name);
} else {
_local4 = (getCardCount() - _arg1.pos);
rules.startDragging(this, getTopCards(_local4), _arg2, _arg3);
};
}
}
}//package src
Section 28
//DragLayer (src.DragLayer)
package src {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
public class DragLayer extends MovieClip {
private var cards:Array;
private var oldParent:MovieClip;
private var source:Pile;
private var xOrg:int;
private var yOrg:int;
private var xOffs:int;
private var yOffs:int;
private var xSlideTo:int;
private var ySlideTo:int;
private var xSlideFrom:int;
private var ySlideFrom:int;
private var animStartTime:int;// = -1
private var gameArea:GameArea;
private var rules:KlondikeRules;
private var dragging:Boolean;// = false
private var slideTime:Number;
public static var SLIDE_TIME:Number = 25;
public function DragLayer(){
slideTime = SLIDE_TIME;
super();
}
public function init(_arg1:GameArea, _arg2:KlondikeRules):void{
this.gameArea = _arg1;
this.rules = _arg2;
}
public function slide(_arg1:Card, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
abort();
this.source = _arg1.pile;
this.cards = new Array();
oldParent = MovieClip(_arg1.parent);
cards.push(_arg1);
_arg1.x = 0;
_arg1.y = 0;
_arg1.parent.removeChild(_arg1);
addChild(_arg1);
xOrg = 0;
yOrg = 0;
x = _arg2;
y = _arg3;
xSlideTo = _arg4;
ySlideTo = _arg5;
startAnim();
gameArea.effectSound.get("card").play(1, ((xSlideTo / 730) - 0.5));
}
public function startDragging(_arg1:Pile, _arg2:Array, _arg3:int, _arg4:int):void{
var _local6:Card;
abort();
this.source = _arg1;
this.cards = _arg2;
this.xOffs = _arg3;
this.yOffs = _arg4;
xOrg = (_arg2[0].x + _arg3);
yOrg = (_arg2[0].y + _arg4);
var _local5:int;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
oldParent = MovieClip(_local6.parent);
_local6.parent.removeChild(_local6);
addChild(_local6);
_local6.x = -(_arg3);
_local6.y = (-(_arg4) + (_local5 * 15));
_local5++;
};
startDrag(true, new Rectangle(0, 0, 730, 450));
stage.addEventListener(MouseEvent.MOUSE_UP, release);
dragging = true;
}
public function release(_arg1:MouseEvent):void{
var _local5:int;
var _local6:Card;
dragging = false;
stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, release);
var _local2:int = ((x - xOffs) + (cards[0].width / 2));
var _local3:int = ((y - yOffs) + (cards[0].height / 2));
var _local4:Pile = gameArea.getPileAt(_local2, _local3, cards[0]);
if (((!((_local4 == null))) && (_local4.mayPushCards(cards)))){
rules.move(cards.length, source.name, _local4.name);
source = _local4;
xSlideTo = (cards[0].x + xOffs);
ySlideTo = (cards[0].y + yOffs);
_local5 = 0;
while (_local5 < cards.length) {
_local6 = cards[_local5];
_local6.x = -(xOffs);
_local6.y = (-(yOffs) + (_local5 * 15));
_local5++;
};
if (cards.length > 1){
gameArea.effectSound.get("severalcards").play(1, ((xSlideTo / 730) - 0.5));
} else {
gameArea.effectSound.get("card").play(1, ((xSlideTo / 730) - 0.5));
};
} else {
xSlideTo = xOrg;
ySlideTo = yOrg;
};
startAnim();
}
private function finishAnim():void{
var _local2:Card;
stopAnim();
var _local1:int;
while (_local1 < cards.length) {
_local2 = cards[_local1];
removeChild(_local2);
oldParent.addChild(_local2);
source.placeCard(_local2, ((source.getCardCount() - cards.length) + _local1));
_local1++;
};
}
private function startAnim():void{
xSlideFrom = x;
ySlideFrom = y;
animStartTime = getTimer();
addEventListener(Event.ENTER_FRAME, advanceTime);
slideTime = SLIDE_TIME;
}
private function stopAnim():void{
animStartTime = -1;
removeEventListener(Event.ENTER_FRAME, advanceTime);
}
public function abort():void{
if (dragging){
dragging = false;
stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, release);
xSlideTo = xOrg;
ySlideTo = yOrg;
startAnim();
release(null);
};
if (animStartTime >= 0){
finishAnim();
};
}
public function advanceTime(_arg1:Event):void{
var _local2:Number = ((getTimer() - animStartTime) / slideTime);
x = (xSlideFrom + ((xSlideTo - xSlideFrom) * _local2));
y = (ySlideFrom + ((ySlideTo - ySlideFrom) * _local2));
if (_local2 > 1){
finishAnim();
};
}
}
}//package src
Section 29
//Fireworks (src.Fireworks)
package src {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
public class Fireworks extends MovieClip {
public var lifeTime:int;// = 1000
public var startTime:int;
public function Fireworks(_arg1:Number, _arg2:Number, _arg3:Number=1){
gotoAndStop(1);
addEventListener(Event.ENTER_FRAME, advanceTime);
this.x = _arg1;
this.y = _arg2;
this.scaleX = (this.scaleY = _arg3);
startTime = getTimer();
blendMode = "screen";
var _local4:Number = ((Math.random() * Math.PI) * 2);
var _local5:Number = ((Math.sin((_local4 + (((0 / 3) * Math.PI) * 2))) * 0.5) + 0.5);
var _local6:Number = ((Math.sin((_local4 + (((1 / 3) * Math.PI) * 2))) * 0.5) + 0.5);
var _local7:Number = ((Math.sin((_local4 + (((2 / 3) * Math.PI) * 2))) * 0.5) + 0.5);
transform.colorTransform = new ColorTransform(_local5, _local6, _local7, 1, 0, 0, 0, 0);
}
public function advanceTime(_arg1:Event):void{
var _local3:int;
var _local2:Number = ((getTimer() - startTime) / lifeTime);
if (_local2 >= 1){
parent.removeChild(this);
removeEventListener(Event.ENTER_FRAME, advanceTime);
} else {
_local3 = int(((_local2 * 18) + 1));
gotoAndStop(_local3);
};
}
}
}//package src
Section 30
//FoundationPile (src.FoundationPile)
package src {
import flash.display.*;
public class FoundationPile extends Pile {
private var suit:int;// = 0
public function FoundationPile(_arg1:MovieClip, _arg2:KlondikeRules, _arg3:String, _arg4:int){
super(_arg1, _arg2, _arg3);
this.suit = _arg4;
}
override public function popCard():Card{
var _local1:Card = super.popCard();
var _local2:Card = getTopCard();
if (_local2 != null){
_local2.setClickable(true);
};
return (_local1);
}
override public function pushCard(_arg1:Card):void{
var _local2:Card = getTopCard();
if (_local2 != null){
_local2.setClickable(false);
};
_arg1.setClickable(true);
super.pushCard(_arg1);
}
override public function popCards(_arg1:int):Array{
return (super.popCards(_arg1));
}
override public function mayPushCards(_arg1:Array):Boolean{
var _local3:Card;
if (_arg1.length > 1){
return (false);
};
var _local2:Card = _arg1[0];
if (getCardCount() > 0){
_local3 = getTopCard();
if (_local2.getSuit() != _local3.getSuit()){
return (false);
};
if (_local2.getValue() != (_local3.getValue() + 1)){
return (false);
};
} else {
if (_local2.getSuit() != suit){
return (false);
};
if (_local2.getValue() != 0){
return (false);
};
};
return (true);
}
override public function pushCards(_arg1:Array):void{
var _local3:int;
var _local2:Card = _arg1[0];
if (!_local2.hasBeenInFoundation()){
_local2.setHasBeenInFoundation(true);
_local3 = (100 - (_local2.getValue() * 10));
if (_local3 < 10){
_local3 = 10;
};
rules.increaseScore(_local3);
};
super.pushCards(_arg1);
}
override public function pressCard(_arg1:Card, _arg2:int, _arg3:int):void{
rules.startDragging(this, getTopCards(1), _arg2, _arg3);
}
}
}//package src
Section 31
//GameArea (src.GameArea)
package src {
import flash.display.*;
import flash.events.*;
import src.sound.*;
import src.intro.*;
import src.util.*;
import flash.text.*;
import flash.external.*;
import flash.utils.*;
import flash.system.*;
public class GameArea extends MovieClip {
public var DEBUG_XML:String;
public var piles:Array;
public var foundations:Array;
public var world:int;
public var musicSound:SoundManager;
public var effectSound:SoundManager;
private var rules:KlondikeRules;
public var scoreField:TextField;
public var scoreText:TextField;
public var timeField:TextField;
public var timeText:TextField;
public var introHolder:MovieClip;
public var clickBlocker:MovieClip;
public var pile0:MovieClip;
public var pile1:MovieClip;
public var pile2:MovieClip;
public var pile3:MovieClip;
public var pile4:MovieClip;
public var pile5:MovieClip;
public var pile6:MovieClip;
public var foundation0:MovieClip;
public var foundation1:MovieClip;
public var foundation2:MovieClip;
public var foundation3:MovieClip;
public var mcHolder:MovieClip;
public var cardHolder:MovieClip;
public var dragLayer:DragLayer;
public var background:MovieClip;
public var deck:MovieClip;
public var revealed:MovieClip;
public var soundButton:SoundButton;
public var musicButton:SoundButton;
public var quitButton:QuitButton;
public var intro:Intro;
public var outro:Outro;
public var gdp:GameDataParser;
private var lastTime:int;
private var lastSeconds:int;
private var startTime:int;// = -1
private var winAnimStartTime:int;// = -1
private var winAnimDelay:int;// = 1000
private var playing:Boolean;// = false
private var unlocked:int;
private var remaining:int;
private var cardList:String;
private var remainingSeconds:int;
public var relaxMode:Boolean;// = false
private var isFirstLevel:Boolean;// = true
private var lastRemainingTime:int;// = 0
private var hasPlayedTimeWarning:Boolean;// = false
private var hasPreparedOutro:Boolean;// = false
private var hasSentGameEnd:Boolean;// = false
private var hasSentQuit:Boolean;// = false
public static var DEBUG_MODE:Boolean = false;
public static var timeLimit:int = 600000;
public static var WIN_ANIM_DURATION:int = 1000;
public function GameArea(){
var _local2:String;
DEBUG_XML = <test/>
.toString();
piles = new Array();
foundations = new Array();
musicSound = new SoundManager();
effectSound = new SoundManager();
gdp = new GameDataParser();
remainingSeconds = ((timeLimit + 999) / 1000);
super();
background.gotoAndStop(1);
piles.push(pile0);
piles.push(pile1);
piles.push(pile2);
piles.push(pile3);
piles.push(pile4);
piles.push(pile5);
piles.push(pile6);
foundations.push(foundation0);
foundations.push(foundation1);
foundations.push(foundation2);
foundations.push(foundation3);
mcHolder.foundationMc0.gotoAndStop(4);
mcHolder.foundationMc1.gotoAndStop(3);
mcHolder.foundationMc2.gotoAndStop(2);
mcHolder.foundationMc3.gotoAndStop(1);
var _local1:Object = ExternalInterface.call("getGameData");
if ((((_local1 == null)) || (!(_local1.success)))){
} else {
DEBUG_MODE = false;
_local2 = _local1.message;
gdp.parse(_local2);
};
if (DEBUG_MODE){
trace(DEBUG_XML);
gdp.parse(DEBUG_XML);
};
relaxMode = gdp.relaxMode;
timeLimit = (gdp.timeLimit * 1000);
unlocked = gdp.unlocked;
remaining = gdp.remaining;
cardList = gdp.cardList;
intro = new Intro(this, unlocked, remaining);
introHolder.addChild(intro);
clickBlocker.alpha = 0;
scoreText.text = TextMappings.get("score");
timeText.text = TextMappings.get("time");
if (relaxMode){
timeText.visible = false;
timeField.visible = false;
cardList = generateCards();
};
addEventListener(Event.ENTER_FRAME, advanceTime);
outro.visible = false;
musicSound.get("titlemusic").play(0.6);
soundButton.init(this);
musicButton.init(this);
quitButton.init(this);
}
public function restartLevel(){
rules.reset(cardList);
}
public function introOver():void{
clickBlocker.visible = false;
startTime = getTimer();
if (isFirstLevel){
isFirstLevel = false;
fscommand("gameStart");
musicSound.get("gamemusic").loop(0.5);
};
}
public function startAutoSolve():void{
clickBlocker.visible = true;
dragLayer.abort();
}
public function getBitmap(_arg1:int):BitmapData{
setWorld(_arg1);
if (rules == null){
rules = new KlondikeRules(this, cardList, world);
dragLayer.init(this, rules);
};
updateTimer();
var _local2:BitmapData = new BitmapData(730, 450);
intro.visible = false;
_local2.draw(this);
intro.visible = true;
return (_local2);
}
public function startGame(_arg1:int, _arg2:int):void{
musicSound.stopAll();
setWorld(_arg1);
introHolder.removeChild(intro);
intro = null;
lastTime = getTimer();
effectSound.get("shuffle").play();
playing = true;
rules.setContinent(_arg2);
}
private function updateTimer():int{
var _local3:int;
var _local4:int;
var _local5:String;
if (relaxMode){
return (lastRemainingTime);
};
if (rules.autoSolve){
return (lastRemainingTime);
};
var _local1:int = timeLimit;
if (startTime >= 0){
_local1 = (timeLimit - (getTimer() - startTime));
};
var _local2:Number = (_local1 / 1000);
if ((((_local2 < 60)) && ((_local2 > 0)))){
_local3 = (0xFF - int((((-(Math.cos(((_local2 * Math.PI) * 2))) * 128) + 128) * (1 - (_local2 / 60)))));
if (_local3 < 0){
_local3 = 0;
};
if (_local3 > 0xFF){
_local3 = 0xFF;
};
timeField.textColor = (((0xFF0000 | (_local3 << 16)) | (_local3 << 8)) | _local3);
} else {
timeField.textColor = 0xFFFFFF;
};
if (lastSeconds != remainingSeconds){
lastSeconds = remainingSeconds;
if (remainingSeconds < 0){
remainingSeconds = 0;
};
_local4 = (remainingSeconds / 60);
remainingSeconds = (remainingSeconds % 60);
_local5 = "";
if (_local4 < 10){
_local5 = (_local5 + "0");
};
_local5 = (_local5 + (_local4 + ":"));
if (remainingSeconds < 10){
_local5 = (_local5 + "0");
};
_local5 = (_local5 + remainingSeconds);
timeField.text = _local5;
};
lastRemainingTime = _local1;
return (_local1);
}
public function advanceTime(_arg1:Event):void{
musicSound.update();
effectSound.update();
if (winAnimStartTime >= 0){
doWinAnim((getTimer() - winAnimStartTime));
return;
};
if (!playing){
return;
};
var _local2:int = updateTimer();
remainingSeconds = ((_local2 + 999) / 1000);
var _local3:int;
if (gdp.gameMode != "full"){
_local3 = ((timeLimit / 1000) - (2 * 60));
};
if ((((remainingSeconds <= ((10 - 1) + _local3))) && (!(hasPlayedTimeWarning)))){
if (!relaxMode){
effectSound.get("timewarning").play();
};
hasPlayedTimeWarning = true;
};
if (remainingSeconds < (0 + _local3)){
outOfTime();
};
var _local4:int = getTimer();
while ((_local4 - lastTime) > 100) {
lastTime = (lastTime + 100);
if (!rules.tick()){
return;
};
};
}
private function doWinAnim(_arg1:int):void{
var _local2:Number = (_arg1 / WIN_ANIM_DURATION);
cardHolder.y = (mcHolder.y = ((0 + (_local2 * 80)) - ((_local2 * _local2) * 400)));
if (_arg1 > (WIN_ANIM_DURATION + winAnimDelay)){
winAnimStartTime = -1;
outro.show();
};
}
public function getPileAt(_arg1:int, _arg2:int, _arg3:Card):Pile{
var _local5:int;
var _local4 = 7;
if (_arg2 < (pile0.y - 8)){
if ((((_arg1 >= (foundations[0].x - _local4))) && ((_arg1 <= ((foundations[3].x + foundations[3].width) + _local4))))){
return (rules.getFoundation(_arg3.suit));
};
} else {
_local5 = 0;
while (_local5 < 7) {
if ((((_arg1 >= (piles[_local5].x - _local4))) && ((_arg1 <= ((piles[_local5].x + piles[_local5].width) + _local4))))){
return (rules.getPile(("c" + _local5)));
};
_local5++;
};
};
return (null);
}
public function setWorld(_arg1:int):void{
this.world = _arg1;
background.gotoAndStop((_arg1 + 1));
}
private function generateCards():String{
var _local6:int;
var _local7:int;
var _local8:Card;
var _local1:Array = new Array();
var _local2:int;
while (_local2 < 4) {
_local6 = 1;
while (_local6 <= 13) {
_local1.push(new Card(_local2, _local6, 0));
_local6++;
};
_local2++;
};
var _local3 = "cdhs";
var _local4 = "";
var _local5:int;
while (_local5 < 52) {
_local7 = (int((Math.random() * (52 - _local5))) + _local5);
_local8 = _local1[_local7];
_local1[_local7] = _local1[_local5];
_local1[_local5] = _local8;
if (_local5 > 0){
_local4 = (_local4 + "_");
};
_local4 = (_local4 + (_local1[_local5].value + _local3.charAt(_local1[_local5].suit)));
_local5++;
};
return (_local4);
}
public function buttonClicked(_arg1:MovieClip):void{
if (_arg1 == soundButton){
effectSound.fadeTo((soundButton.isOn) ? 1 : 0, 250);
};
if (_arg1 == musicButton){
musicSound.fadeTo((musicButton.isOn) ? 1 : 0, 250);
};
if (_arg1 == quitButton){
clickQuit();
};
}
public function outOfTime():void{
if (hasPreparedOutro){
return;
};
hasPreparedOutro = true;
var _local1:String = TextMappings.get("out_of_time");
var _local2:int;
var _local3 = "";
if (gdp.gameMode != "full"){
_local3 = TextMappings.get("nag_message");
};
prepareOutro(_local1, _local3, _local2, false, false);
outro.show();
}
public function clickQuit():void{
if (hasPreparedOutro){
return;
};
hasPreparedOutro = true;
var _local1:String = TextMappings.get("player_quit");
var _local2:int;
var _local3 = "";
prepareOutro(_local1, _local3, _local2, true, false);
outro.show();
}
public function win():void{
var _local4:Boolean;
var _local5:String;
if (relaxMode){
restartLevel();
return;
};
if (hasPreparedOutro){
return;
};
hasPreparedOutro = true;
var _local1:String = TextMappings.get("level_won");
var _local2 = 4;
var _local3 = "";
if ((((gdp.playerType == "money")) && (!(relaxMode)))){
remaining--;
_local4 = false;
if ((((remaining == 0)) && ((unlocked == 5)))){
_local1 = TextMappings.get("all_unlocked");
_local2 = 10;
_local4 = true;
};
winAnimDelay = 2000;
if (unlocked < 6){
_local5 = TextMappings.get(Intro.CONTINENT_NAME_MAP[unlocked]);
if (remaining > 1){
_local3 = TextMappings.get("unlock_next_in").split("[0]").join(remaining).split("[1]").join(_local5);
} else {
if (remaining > 0){
_local3 = TextMappings.get("unlock_next_in_singular").split("[0]").join(_local5);
} else {
winAnimDelay = 0;
_local2 = 6;
_local3 = TextMappings.get("new_unlocked").split("[0]").join(_local5);
};
};
};
};
winAnimStartTime = getTimer();
prepareOutro(_local1, _local3, _local2, true, _local4);
}
private function prepareOutro(_arg1:String, _arg2:String, _arg3:int, _arg4:Boolean, _arg5:Boolean):void{
if (_arg3 == 0){
effectSound.get("badend").play();
} else {
effectSound.get("goodend").play();
};
effectSound.get("timewarning").stop();
musicSound.get("gamemusic").stop();
clickBlocker.visible = true;
playing = false;
var _local6:int = rules.getCalculatedScore();
rules.gameOver(remainingSeconds, _arg4);
var _local7:int = rules.getCalculatedScore();
outro.prepare(this, _arg1, _arg2, _arg3, _local6, _local7, _arg5, remaining, (unlocked + 1));
if (!hasSentGameEnd){
fscommand("gameEnd", ("" + rules.getCalculatedScore()));
};
}
public function sendQuit():void{
if (!hasSentQuit){
fscommand("gameQuit");
hasSentQuit = true;
};
}
}
}//package src
Section 32
//HandSourcePile (src.HandSourcePile)
package src {
import flash.display.*;
public class HandSourcePile extends Pile {
public var handTargetPile:HandTargetPile;
public function HandSourcePile(_arg1:MovieClip, _arg2:KlondikeRules, _arg3:String){
super(_arg1, _arg2, _arg3);
}
override public function pileClicked():void{
if (handTargetPile.getCardCount() == 0){
return;
};
rules.flip();
}
override public function popCard():Card{
var _local1:Card = super.popCard();
var _local2:Card = getTopCard();
if (_local2 != null){
_local2.setClickable(true);
};
updateClickable();
return (_local1);
}
override public function pushCard(_arg1:Card):void{
var _local2:Card = getTopCard();
if (_local2 != null){
_local2.setClickable(false);
};
_arg1.setClickable(true);
_arg1.hide();
super.pushCard(_arg1);
updateClickable();
}
public function updateClickable():void{
setClickable((((handTargetPile.getCardCount() > 0)) && ((getCardCount() == 0))));
}
override public function revealTopCard():void{
super.revealTopCard();
handTargetPile.pushCard(popCard());
}
override public function pressCard(_arg1:Card, _arg2:int, _arg3:int):void{
var _local4:Card = getTopCard();
rules.stopDragging();
_local4.prepareSlide();
rules.reveal(name);
_local4.slide(rules);
}
}
}//package src
Section 33
//HandTargetPile (src.HandTargetPile)
package src {
import flash.display.*;
public class HandTargetPile extends Pile {
public var handSourcePile:HandSourcePile;
public function HandTargetPile(_arg1:MovieClip, _arg2:KlondikeRules, _arg3:String){
super(_arg1, _arg2, _arg3);
}
override public function popCard():Card{
var _local1:Card = super.popCard();
var _local2:Card = getTopCard();
if (_local2 != null){
_local2.setClickable(true);
};
handSourcePile.updateClickable();
return (_local1);
}
override public function pushCard(_arg1:Card):void{
var _local2:Card = getTopCard();
if (_local2 != null){
_local2.setClickable(false);
};
_arg1.setClickable(true);
_arg1.reveal();
super.pushCard(_arg1);
handSourcePile.updateClickable();
}
override public function doubleClickCard(_arg1:Card):void{
if (_arg1 == getTopCard()){
tryClickToFoundation(_arg1);
};
}
override public function popCards(_arg1:int):Array{
rules.increaseScore(20);
return (super.popCards(_arg1));
}
override public function pushCards(_arg1:Array):void{
}
override public function pressCard(_arg1:Card, _arg2:int, _arg3:int):void{
rules.startDragging(this, getTopCards(1), _arg2, _arg3);
}
}
}//package src
Section 34
//KlondikeRules (src.KlondikeRules)
package src {
import flash.external.*;
public class KlondikeRules {
private var piles:Object;
private var handSourcePile:HandSourcePile;
private var handTargetPile:HandTargetPile;
private var score:int;// = 0
private var hasClaimedTimeBonus:Boolean;// = false
private var gameArea:GameArea;
private var foundationSuitMap:Array;
private var introStep:int;// = 0
public var autoSolve:Boolean;// = false
private var allCards:Array;
private var continent:int;
private var foundationMap:Array;
public function KlondikeRules(_arg1:GameArea, _arg2:String, _arg3:int){
piles = new Object();
foundationSuitMap = [2, 3, 1, 0];
allCards = new Array();
foundationMap = [3, 2, 0, 1];
super();
this.gameArea = _arg1;
this.continent = _arg3;
handSourcePile = new HandSourcePile(_arg1.deck, this, "h0");
handTargetPile = new HandTargetPile(_arg1.revealed, this, "h1");
handSourcePile.handTargetPile = handTargetPile;
handTargetPile.handSourcePile = handSourcePile;
piles["h0"] = handSourcePile;
piles["h1"] = handTargetPile;
var _local4:int;
while (_local4 < 4) {
piles[("f" + _local4)] = new FoundationPile(_arg1.foundations[_local4], this, ("f" + _local4), foundationSuitMap[_local4]);
_local4++;
};
_local4 = 0;
while (_local4 < 7) {
piles[("c" + _local4)] = new ColumnPile(_arg1.piles[_local4], this, ("c" + _local4));
_local4++;
};
reset(_arg2);
}
public function reset(_arg1:String):void{
var _local6:Card;
var _local7:String;
var _local8:int;
var _local9:String;
var _local10:int;
var _local11:int;
autoSolve = false;
while (allCards.length > 0) {
_local6 = allCards.pop();
gameArea.cardHolder.removeChild(_local6);
};
piles["h0"].reset();
piles["h1"].reset();
var _local2:int;
while (_local2 < 4) {
piles[("f" + _local2)].reset();
_local2++;
};
_local2 = 0;
while (_local2 < 7) {
piles[("c" + _local2)].reset();
_local2++;
};
var _local3:Array = _arg1.split("_");
_local2 = 0;
while (_local2 < 52) {
_local7 = _local3[_local2];
_local8 = (parseInt(_local7.substring(0, (_local7.length - 1))) - 1);
_local9 = _local7.substring((_local7.length - 1));
_local10 = 0;
if (_local9 == "c"){
_local10 = 0;
};
if (_local9 == "d"){
_local10 = 1;
};
if (_local9 == "s"){
_local10 = 2;
};
if (_local9 == "h"){
_local10 = 3;
};
_local6 = new Card(_local10, _local8, continent);
allCards.push(_local6);
gameArea.cardHolder.addChild(_local6);
handSourcePile.pushCard(_local6);
_local2++;
};
var _local4:Array = new Array(7);
var _local5:int;
while (_local5 < 7) {
_local4[_local5] = new Array();
_local11 = 0;
while (_local11 <= _local5) {
_local4[_local5].push(handSourcePile.popCard());
_local11++;
};
_local5++;
};
_local11 = 6;
while (_local11 >= 0) {
_local5 = 6;
while (_local5 >= 0) {
if (_local4[_local5].length == (_local11 + 1)){
handSourcePile.pushCard(_local4[_local5].pop());
};
_local5--;
};
_local11--;
};
introStep = -6;
scoreUpdated();
}
public function tick():Boolean{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Pile;
var _local5:Card;
var _local6:int;
if (introStep < 0){
introStep++;
} else {
if (introStep < ((((((7 + 6) + 5) + 4) + 3) + 2) + 1)){
_local1 = 0;
_local2 = 7;
_local3 = introStep;
while (_local3 >= _local2) {
_local3 = (_local3 - _local2);
_local1++;
_local2--;
};
_local4 = Pile(piles[("c" + (_local3 + _local1))]);
_local5 = handSourcePile.popCard();
DragLayer.SLIDE_TIME = 60;
_local5.prepareSlide();
if (_local3 == 0){
_local5.reveal();
};
_local4.pushCard(_local5);
_local5.slide(this);
DragLayer.SLIDE_TIME = 25;
introStep++;
if (introStep == ((((((7 + 6) + 5) + 4) + 3) + 2) + 1)){
gameArea.introOver();
};
} else {
if (hasWon()){
gameArea.win();
return (false);
};
if (autoSolve){
_local4 = getPile("h1");
if (_local4.getCardCount() > 0){
if (_local4.tryClickToFoundation(_local4.getTopCard())){
return (true);
};
};
_local6 = 0;
while (_local6 < 7) {
_local4 = getPile(("c" + _local6));
if (_local4.getCardCount() > 0){
if (_local4.tryClickToFoundation(_local4.getTopCard())){
return (true);
};
};
_local6++;
};
} else {
if (isSolveable()){
autoSolve = true;
gameArea.startAutoSolve();
playData("101", 0);
};
};
};
};
return (true);
}
public function setContinent(_arg1:int):void{
playData(("11," + _arg1), 0);
}
private function isSolveable():Boolean{
if (getPile("h0").getCardCount() != 0){
return (false);
};
if (getPile("h1").getCardCount() > 1){
return (false);
};
var _local1:int;
while (_local1 < 7) {
if (getPile(("c" + _local1)).hasHiddenCard()){
return (false);
};
_local1++;
};
return (true);
}
public function move(_arg1:int, _arg2:String, _arg3:String):void{
var _local7:Card;
var _local4:int = score;
var _local5:Pile = piles[_arg2];
var _local6:Pile = piles[_arg3];
if ((((_local5 is FoundationPile)) && (!((_local6 is FoundationPile))))){
increaseScore(-20);
};
_local6.pushCards(_local5.popCards(_arg1));
playData(((((("001," + _arg1) + ",") + _local5.name) + ",") + _local6.name), (score - _local4));
if (_arg2.indexOf("c") == 0){
_local7 = _local5.getTopCard();
if (((!((_local7 == null))) && (!(_local7.isRevealed())))){
reveal(_arg2);
};
};
}
public function reveal(_arg1:String):void{
var _local2:int = score;
var _local3:Pile = piles[_arg1];
_local3.revealTopCard();
playData(("010," + _arg1), (score - _local2));
}
public function flip():void{
var _local2:Card;
var _local1:int = score;
increaseScore(-200);
while (handTargetPile.getCardCount() > 0) {
_local2 = handTargetPile.popCard();
_local2.hide();
handSourcePile.pushCard(_local2);
};
playData("100", (score - _local1));
}
public function gameOver(_arg1:int, _arg2:Boolean):void{
var _local4:int;
var _local3:int = score;
if (_arg2){
_local4 = int(Math.floor(((_arg1 * (countCardsInFoundations() / 52)) * 2)));
trace(("timeBonus: " + _local4));
score = (score + _local4);
hasClaimedTimeBonus = true;
scoreUpdated();
};
playData(((((("111," + _local3) + ",") + _arg1) + ",") + score), (score - _local3));
}
public function countCardsInFoundations():int{
var _local3:Pile;
var _local1:int;
var _local2:int;
while (_local2 < 4) {
_local3 = piles[("f" + _local2)];
_local1 = (_local1 + _local3.getCardCount());
_local2++;
};
return (_local1);
}
public function hasWon():Boolean{
return ((countCardsInFoundations() == 52));
}
public function increaseScore(_arg1:int):void{
score = (score + _arg1);
if (score < 0){
score = 0;
};
scoreUpdated();
}
public function getCalculatedScore():int{
return (score);
}
private function scoreUpdated():void{
gameArea.scoreField.text = ("" + score);
}
public function startDragging(_arg1:Pile, _arg2:Array, _arg3:int, _arg4:int):void{
gameArea.dragLayer.startDragging(_arg1, _arg2, _arg3, _arg4);
}
public function slide(_arg1:Card, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
gameArea.dragLayer.slide(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function getPile(_arg1:String):Pile{
return (piles[_arg1]);
}
public function getFoundation(_arg1:int):Pile{
return (getPile(("f" + foundationMap[_arg1])));
}
public function stopDragging():void{
gameArea.dragLayer.abort();
}
private function playData(_arg1:String, _arg2:Number):void{
ExternalInterface.call("playData", ((_arg1 + "=") + _arg2));
}
}
}//package src
Section 35
//Outro (src.Outro)
package src {
import flash.display.*;
import flash.events.*;
import src.intro.*;
import src.util.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
public class Outro extends MovieClip {
public var statusField:TextField;
public var timerField:TextField;
public var titleField:TextField;
public var subStatusField:TextField;
public var scoreLabel:TextField;
public var scoreField:TextField;
public var bonusLabel:TextField;
public var bonusField:TextField;
public var totalLabel:TextField;
public var totalField:TextField;
public var unlockText:TextField;
public var fireworksHolder:MovieClip;
public var bg:MovieClip;
public var globeHolder:MovieClip;
public var glowAnim:MovieClip;
public var light0:MovieClip;
public var light1:MovieClip;
public var bouncingCoin:BouncingCoin;
public var gameArea:GameArea;
private var startTime:int;
private var state:int;// = -1
private var fireworksTime:int;// = 0
private var fireworks:int;// = 0
private var doCoin:Boolean;
private var gracePeriod:int;
private var skipGlobeAnim:Boolean;// = false
private var target:int;
private var remaining:int;// = 0
private var hasPlayedUnlockSound:Boolean;// = false
private var statesTilMusic:int;// = 1
public static var DISPLAY_TIME:int = 19000;
public static var FIREWORKS_INTERVAL:int = 80;
public function prepare(_arg1:GameArea, _arg2:String, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean, _arg8:int, _arg9:int):void{
this.gameArea = _arg1;
this.fireworks = (_arg4 * 5);
this.doCoin = _arg7;
glowAnim.visible = (_arg4 > 0);
statusField.text = _arg2;
this.remaining = _arg8;
this.target = _arg9;
subStatusField.text = _arg3;
titleField.text = TextMappings.get("game_over");
scoreLabel.text = TextMappings.get("score");
bonusLabel.text = TextMappings.get("bonus");
totalLabel.text = TextMappings.get("total_score");
scoreField.text = ("" + _arg5);
bonusField.text = ("" + (_arg6 - _arg5));
totalField.text = ("" + _arg6);
useHandCursor = true;
buttonMode = true;
timerField.mouseEnabled = false;
statusField.mouseEnabled = false;
fireworksHolder.mouseEnabled = false;
subStatusField.mouseEnabled = false;
titleField.mouseEnabled = false;
scoreLabel.mouseEnabled = false;
bonusLabel.mouseEnabled = false;
totalLabel.mouseEnabled = false;
scoreField.mouseEnabled = false;
bonusField.mouseEnabled = false;
totalField.mouseEnabled = false;
globeHolder.globe.cloud0.visible = false;
globeHolder.globe.cloud1.visible = false;
globeHolder.globe.cloud2.visible = false;
globeHolder.globe.glow.visible = false;
unlockText.text = _arg3;
if ((((_arg4 > 0)) && ((_arg8 > 0)))){
statesTilMusic--;
};
if ((((_arg8 == 0)) && ((_arg9 < 6)))){
statesTilMusic--;
};
if (_arg7){
DISPLAY_TIME = (DISPLAY_TIME + 3000);
};
}
public function show():void{
visible = true;
addEventListener(MouseEvent.MOUSE_DOWN, clicked);
startTime = getTimer();
advanceTime(null);
if (remaining == 0){
addEventListener(Event.ENTER_FRAME, advanceGlobeAnim);
setState(-1);
} else {
addEventListener(Event.ENTER_FRAME, advanceTime);
setState(0);
};
}
private function setState(_arg1:int):void{
if (this.state == _arg1){
return;
};
this.state = _arg1;
if ((((_arg1 == 0)) && (doCoin))){
gameArea.musicSound.get("allunlocked").play();
bouncingCoin.startAnim();
};
if (statesTilMusic-- == 0){
gameArea.musicSound.stopAll();
gameArea.musicSound.get("gameovermusic").play();
};
gracePeriod = (getTimer() + 500);
if (_arg1 == 2){
gameArea.sendQuit();
};
globeHolder.visible = (_arg1 == -1);
var _local2 = (_arg1 == 0);
var _local3 = (_arg1 > 0);
unlockText.visible = (_arg1 == -1);
statusField.visible = _local2;
fireworksHolder.visible = _local2;
subStatusField.visible = _local3;
titleField.visible = _local3;
scoreLabel.visible = _local3;
bonusLabel.visible = _local3;
totalLabel.visible = _local3;
scoreField.visible = _local3;
bonusField.visible = _local3;
totalField.visible = _local3;
bouncingCoin.visible = ((_local2) && (doCoin));
if (gameArea.relaxMode){
bonusField.visible = false;
bonusLabel.visible = false;
};
}
public function advanceGlobeAnim(_arg1:Event):void{
var _local16:int;
var _local17:Number;
var _local18:GlowFilter;
var _local2:int = (getTimer() - startTime);
var _local3:Number = (_local2 / 5000);
y = (60 - 450);
bg.y = -(y);
bg.alpha = 0;
var _local4:Number = (((1 - _local3) * 2) - 1);
if (_local4 < 0){
_local4 = 0;
};
if (_local4 > 1){
_local4 = 1;
};
var _local5:Number = (((Math.cos((_local4 * Math.PI)) * _local4) * _local4) * 600);
var _local6:Number = (((-(Math.sin((_local4 * Math.PI))) * _local4) * _local4) * 200);
var _local7:Number = ((_local3 - 0.9) / 0.1);
if (_local7 < 0){
_local7 = 0;
};
if (_local7 > 1){
_local7 = 1;
};
_local7 = ((_local7 * _local7) * 300);
globeHolder.x = (288.6 + _local5);
globeHolder.y = (((192.7 + _local6) + 450) + _local7);
var _local8:Number = (1 / (((_local4 * _local4) * 1.2) + 1));
var _local9:Array = [0, 0, 0xFF00FF, 0xA27100, 0xFF9900, 4666367, 13434675];
if ((((_local3 >= 0.49)) && (!(hasPlayedUnlockSound)))){
gameArea.effectSound.get("unlockLevel").play();
hasPlayedUnlockSound = true;
};
var _local10:Number = (((_local3 - 0.49) / 0.51) * 5);
if (_local10 < 0){
_local10 = 0;
};
if (_local10 > 1){
_local10 = 1;
};
unlockText.textColor = _local9[target];
unlockText.alpha = ((_local10 * _local10) * _local10);
unlockText.y = ((295.4 + 450) + _local7);
var _local11:Number = (((_local3 - 0.49) / 0.51) * 2);
_local11 = Math.sqrt(_local11);
_local11 = Math.sqrt(_local11);
if (_local11 < 0){
_local11 = 0;
};
if (_local11 > 1){
_local11 = 1;
};
var _local12:Number = (((_local3 - 0.49) / 0.51) * 1.6);
_local12 = Math.sqrt(_local12);
if (_local12 < 0){
_local12 = 0;
};
if (_local12 > 1){
_local12 = 1;
};
globeHolder.light.alpha = (Math.sin((_local11 * Math.PI)) * 0.7);
globeHolder.light0.alpha = Math.sin((_local12 * Math.PI));
globeHolder.light1.alpha = Math.sin((_local12 * Math.PI));
var _local13:Number = ((Math.sin((_local12 * Math.PI)) * 0.6) + 0.5);
globeHolder.light0.scaleX = (globeHolder.light0.scaleY = _local13);
globeHolder.light1.scaleX = (globeHolder.light1.scaleY = _local13);
globeHolder.light0.rotation = (getTimer() * 0.13);
globeHolder.light1.rotation = (-(getTimer()) * 0.14);
if (_local11 > 0){
_local16 = (Math.sin((_local11 * Math.PI)) * 10);
_local17 = Math.sin((_local11 * Math.PI));
_local17 = ((((Math.sin((_local11 * Math.PI)) * _local17) * _local17) * 8) + 1);
_local18 = new GlowFilter(0xFFFFFF, 1, _local16, _local16, _local17, BitmapFilterQuality.MEDIUM);
globeHolder.light.filters = new Array(_local18);
};
globeHolder.globe.scaleX = (globeHolder.globe.scaleY = _local8);
var _local14:Array = [0, 4, 6, 3, 5, 1, 2];
var _local15:Array = [0, 0, 5, 3, 4, 1, 2];
globeHolder.light.gotoAndStop(_local15[target]);
globeHolder.globe.lerp(_local14[target], (1 - _local4));
if ((((_local3 > 1)) || (skipGlobeAnim))){
startTime = getTimer();
removeEventListener(Event.ENTER_FRAME, advanceGlobeAnim);
addEventListener(Event.ENTER_FRAME, advanceTime);
setState(0);
};
}
public function advanceTime(_arg1:Event):void{
var _local2:int = (getTimer() - startTime);
var _local3:Number = ((800 - _local2) / 800);
if (_local3 < 0){
_local3 = 0;
};
y = (60 - ((_local3 * _local3) * 450));
bg.y = -(y);
bg.alpha = (1 - (_local3 * _local3));
spawnFireworks(_local2);
if (doCoin){
if ((((_local2 > 6000)) && ((state == 0)))){
setState(1);
};
} else {
if ((((_local2 > 3000)) && ((state == 0)))){
setState(1);
};
};
if ((((_local2 > DISPLAY_TIME)) && ((state == 1)))){
setState(2);
};
var _local4:int = (DISPLAY_TIME - _local2);
var _local5:int = int(((_local4 + 999) / 1000));
if (_local5 < 0){
_local5 = 0;
};
timerField.text = TextMappings.get("time_to_exit").split("[0]").join(("" + _local5));
}
public function spawnFireworks(_arg1:int):void{
var _local2:Number;
var _local3:Number;
var _local4:Fireworks;
while (((((_arg1 - fireworksTime) > 0)) && ((fireworks > 0)))) {
fireworks--;
fireworksTime = (fireworksTime + ((Math.random() + 0.5) * FIREWORKS_INTERVAL));
_local2 = ((Math.random() * (515 - 100)) + 50);
_local3 = ((Math.random() * (338.1 - 100)) + 50);
_local4 = new Fireworks(_local2, _local3, ((Math.random() * 0.5) + 0.75));
fireworksHolder.addChild(_local4);
};
}
public function clicked(_arg1:MouseEvent):void{
if (getTimer() < gracePeriod){
return;
};
if (state == -1){
skipGlobeAnim = true;
} else {
if (state == 0){
setState(1);
} else {
if (state == 1){
setState(2);
};
};
};
}
}
}//package src
Section 36
//Pile (src.Pile)
package src {
import flash.display.*;
import flash.events.*;
public class Pile {
protected var cards:Array;
public var rules:KlondikeRules;
public var mc:MovieClip;
public var name:String;
private var clickable:Boolean;// = false
public function Pile(_arg1:MovieClip, _arg2:KlondikeRules, _arg3:String){
cards = new Array();
super();
this.mc = _arg1;
this.rules = _arg2;
this.name = _arg3;
_arg1.alpha = 0;
_arg1.buttonMode = true;
_arg1.useHandCursor = false;
}
public function reset(){
cards = new Array();
setClickable(false);
}
public function doubleClickCard(_arg1:Card):void{
}
public function hasHiddenCard():Boolean{
if (cards.length == 0){
return (false);
};
return (!(cards[0].isRevealed()));
}
public function tryClickToFoundation(_arg1:Card):Boolean{
var _local2:Pile = rules.getFoundation(_arg1.suit);
if (_local2.mayPushCards(new Array(_arg1))){
rules.stopDragging();
_arg1.prepareSlide();
rules.move(1, name, _local2.name);
_arg1.slide(rules);
return (true);
};
return (false);
}
public function setClickable(_arg1:Boolean):void{
if (this.clickable == _arg1){
return;
};
this.clickable = _arg1;
if (_arg1){
mc.addEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
};
if (!_arg1){
mc.removeEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
};
mc.useHandCursor = _arg1;
}
public function doMouseDown(_arg1:MouseEvent):void{
pileClicked();
}
public function pileClicked():void{
}
public function popCards(_arg1:int):Array{
var _local2:Array = new Array(_arg1);
var _local3:int;
while (_local3 < _arg1) {
_local2[((_arg1 - 1) - _local3)] = popCard();
_local3++;
};
return (_local2);
}
public function getTopCards(_arg1:int):Array{
var _local2:Array = new Array(_arg1);
var _local3:int;
while (_local3 < _arg1) {
_local2[((_arg1 - 1) - _local3)] = cards[((cards.length - _local3) - 1)];
_local3++;
};
return (_local2);
}
public function pushCards(_arg1:Array):void{
var _local2:int;
while (_local2 < _arg1.length) {
pushCard(_arg1[_local2]);
_local2++;
};
}
public function popCard():Card{
var _local1:Card = cards.pop();
return (_local1);
}
public function pushCard(_arg1:Card):void{
placeCard(_arg1, cards.length);
_arg1.pile = this;
_arg1.pos = cards.length;
var _local2:MovieClip = MovieClip(_arg1.parent);
_local2.removeChild(_arg1);
_local2.addChild(_arg1);
cards.push(_arg1);
}
public function getCardCount():int{
return (cards.length);
}
public function getTopCard():Card{
return (cards[(cards.length - 1)]);
}
public function placeCard(_arg1:Card, _arg2:int):void{
_arg1.x = (mc.x - int(((_arg2 + 7) / 8)));
_arg1.y = (mc.y - (int(((_arg2 + 7) / 8)) * 2));
}
public function revealTopCard():void{
var _local1:Card = cards[(cards.length - 1)];
_local1.reveal();
}
public function mayPushCards(_arg1:Array):Boolean{
return (false);
}
public function pressCard(_arg1:Card, _arg2:int, _arg3:int):void{
}
}
}//package src
Section 37
//QuitButton (src.QuitButton)
package src {
import flash.display.*;
import flash.events.*;
import src.util.*;
import flash.text.*;
public class QuitButton extends MovieClip {
public var hitBox:MovieClip;
public var gameArea:GameArea;
public var textLabel0:TextField;
public var textLabel1:TextField;
public function QuitButton(){
hitBox.alpha = 0;
hitBox.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
hitBox.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
hitBox.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
buttonMode = true;
doubleClickEnabled = true;
gotoAndStop(1);
}
public function init(_arg1:GameArea):void{
this.gameArea = _arg1;
textLabel0.text = TextMappings.get("endgame");
textLabel1.text = TextMappings.get("endgame");
}
public function mouseOver(_arg1:MouseEvent):void{
textLabel0.visible = false;
textLabel1.visible = true;
gotoAndStop(2);
}
public function mouseOut(_arg1:MouseEvent):void{
textLabel0.visible = true;
textLabel1.visible = false;
gotoAndStop(1);
}
public function mouseDown(_arg1:MouseEvent):void{
gameArea.buttonClicked(this);
}
}
}//package src
Section 38
//SoundButton (src.SoundButton)
package src {
import flash.display.*;
import flash.events.*;
public class SoundButton extends MovieClip {
public var hitBox:MovieClip;
public var isOn:Boolean;// = true
public var gameArea:GameArea;
public function SoundButton(){
hitBox.alpha = 0;
hitBox.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
hitBox.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
hitBox.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
buttonMode = true;
doubleClickEnabled = true;
gotoAndStop((1 + (isOn) ? 0 : 2));
}
public function init(_arg1:GameArea):void{
this.gameArea = _arg1;
}
public function mouseOver(_arg1:MouseEvent):void{
gotoAndStop((2 + (isOn) ? 0 : 2));
}
public function mouseOut(_arg1:MouseEvent):void{
gotoAndStop((1 + (isOn) ? 0 : 2));
}
public function mouseDown(_arg1:MouseEvent):void{
isOn = !(isOn);
gotoAndStop((2 + (isOn) ? 0 : 2));
gameArea.buttonClicked(this);
}
}
}//package src
Section 39
//button_music (button_music)
package {
import src.*;
public dynamic class button_music extends SoundButton {
}
}//package
Section 40
//button_sound (button_sound)
package {
import src.*;
public dynamic class button_sound extends SoundButton {
}
}//package