Frame 1
_root.gamemode = 2;
var game = (new com.midasplayer.game.mahjongmasquerade.Game());
Symbol 143 MovieClip Frame 50
stop();
Symbol 143 MovieClip Frame 100
stop();
Symbol 143 MovieClip Frame 150
stop();
Symbol 145 MovieClip [animstar] Frame 1
this.onEnterFrame = function () {
var _local2 = 1 - ((this._totalframes - this._currentframe) / this._totalframes);
if (_local2 < 0.1) {
_local2 = 0;
}
_local2 = _local2 * _local2;
this._y = this._y + (_local2 * 1.5);
};
if (this.delay == undefined) {
this.delay = random(6) + 30;
}
if (this.rotation == undefined) {
this.rotation = random(360);
this._rotation = this.rotation;
}
if (this.mscale == undefined) {
this.mscale = random(70);
this._xscale = this.mscale;
this._yscale = this.mscale;
}
if (this.frame == undefined) {
this.frame = 0;
}
if (this.manager.runningstars == undefined) {
this.manager.runningstars = 0;
}
if (this.manager.generatestars || (this.manager.generatestars == undefined)) {
this.manager.generatestars = false;
this.manager.starsx1 = (377.5 + random(1600)) - 800;
this.manager.starsy1 = 520 + random(500);
if (random(2) == 0) {
this.manager.starsx2 = (167.5 + random(40)) - 20;
this.manager.starsy2 = 155 + random(30);
} else {
this.manager.starsx2 = (587.5 + random(40)) - 20;
this.manager.starsy2 = 155 + random(30);
}
this.manager.sframe = random(3) * 50;
}
if ((this.manager != undefined) && (this.manager.waitcount == undefined)) {
this.manager.waitcount = 20 + random(10);
}
if ((this.manager.runningstars > 0) || (this.frame == 0)) {
this._visible = false;
} else if (this.inited == undefined) {
this.inited = true;
this._visible = true;
this.x1 = this.manager.starsx1;
this.y1 = this.manager.starsy1;
this.x2 = this.manager.starsx2 + random(3);
this.y2 = this.manager.starsy2 + random(3);
this._x = this.x1;
this._y = this.y1;
}
Symbol 145 MovieClip [animstar] Frame 2
if (this == this.manager) {
this.manager.waitcount--;
}
if ((this.manager == undefined) || (this.manager.waitcount > 0)) {
gotoAndPlay (1);
} else if (this.manager.runningstars > 0) {
gotoAndPlay (1);
} else {
var p = (1 - ((30 - this.frame) / 30));
if (p > 1) {
p = 1;
}
var p2 = p;
p = 1 - (((1 - p) * (1 - p)) * (1 - p));
p2 = (p2 * p2) * p2;
var ysub = (p2 * 50);
this.frame++;
if (this.frame < this.delay) {
this._x = this.x1 + ((this.x2 - this.x1) * p);
this._y = (this.y1 + ((this.y2 - this.y1) * p)) + ysub;
gotoAndPlay (1);
} else {
this.rotation = undefined;
this.mscale = undefined;
this.frame = undefined;
this.delay = undefined;
this.inited = undefined;
var f = this.manager.sframe;
trace(f);
this.star.star.gotoAndPlay((f + random(10)) + 1);
}
}
Symbol 145 MovieClip [animstar] Frame 32
this.manager.runningstars++;
this.manager.waitcount = undefined;
Symbol 145 MovieClip [animstar] Frame 58
this.manager.runningstars--;
if (this.manager.runningstars == 0) {
this.manager.generatestars = true;
}
Symbol 148 MovieClip [__Packages.com.midasplayer.util.GameBase] Frame 0
class com.midasplayer.util.GameBase
{
static var gameData, game_, checkGameDataIntervalId_;
function GameBase () {
gameMode_ = GAME_MODE_MONEY;
}
function startGame() {
}
static function setGameMode(gameMode) {
gameMode_ = gameMode;
}
static function getGameMode() {
return(gameMode_);
}
static function setGameType(gameType) {
gameType_ = gameType;
}
static function getGameType() {
return(gameType_);
}
static function getGameData() {
return(gameData);
}
static function reportGameStart() {
com.midasplayer.util.Log.debug("gameStart");
fscommand ("gameStart");
}
static function reportGameEnd(score) {
com.midasplayer.util.Log.debug("gameEnd " + String(score));
fscommand ("gameEnd", String(score));
}
static function reportGameQuit() {
com.midasplayer.util.Log.debug("gameQuit");
fscommand ("gameQuit");
}
function reportGameOver(score) {
com.midasplayer.util.Log.debug("gameOver " + String(score));
fscommand ("gameOver", String(score));
}
static function reportPlayData(pCode, pData, pScore) {
if ((gameMode_ != GAME_MODE_MONEY) || (relaxMode_)) {
return(undefined);
}
var _local1;
_local1 = String(pCode);
if ((pData != null) && (pData.length > 0)) {
_local1 = _local1 + ("," + pData);
}
if (((pScore != undefined) && (pScore != null)) && (pScore.length > 0)) {
_local1 = _local1 + ("=" + pScore);
}
trace(_local1);
com.midasplayer.util.Log.debug("playData " + _local1);
fscommand ("playData", "" + _local1);
}
static function runsLocal() {
return(_root._URL.substr(0, 5).toLowerCase() == "file:");
}
function init(game) {
game_ = game;
checkGameDataIntervalId_ = setInterval(this, "checkGameData", 200);
}
function checkGameData() {
if (!hasGameData_) {
if (((_root.gameData != null) && (_root.gameData != undefined)) && (_root.gameData != "")) {
hasGameData_ = true;
parseGameData(_root.gameData);
clearInterval(checkGameDataIntervalId_);
game_.startGame();
}
}
}
function parseGameData(myData) {
gameData = new com.midasplayer.util.Map();
var _local7 = new XML();
_local7.ignoreWhite = true;
_local7.parseXML(myData);
var _local4 = _local7.firstChild;
if (_local4.nodeName == "gamedata") {
for (var _local6 in _local4.attributes) {
var _local5;
var _local2 = _local4.attributes[_local6];
gameData.put(_local6, _local2);
}
var _local1 = _local4.firstChild;
while (_local1 != null) {
if (_local1.nodeName == "text") {
com.midasplayer.util.I18n.addTranslation(String(_local1.attributes.id), String(_local1.firstChild));
} else {
var _local3 = "0";
for (var _local6 in _local1.attributes) {
var _local2 = _local1.attributes[_local6];
if (_local6 == "id") {
_local3 = _local2;
} else {
gameData.put((((_local1.nodeName + ".") + _local3) + ".") + _local6, _local2);
}
}
gameData.put(((_local1.nodeName + ".") + _local3) + ".nodeData", _local1.firstChild);
}
_local1 = _local1.nextSibling;
}
}
}
static var GAME_MODE_DEBUG = 0;
static var GAME_MODE_PRACTICE = 1;
static var GAME_MODE_MONEY = 2;
static var GAME_TYPE_SINGLE = 0;
static var GAME_TYPE_MULTI = 1;
static var gameMode_ = GAME_MODE_DEBUG;
static var gameType_ = GAME_TYPE_SINGLE;
static var hasGameData_ = false;
static var relaxMode_ = false;
}
Symbol 149 MovieClip [__Packages.com.midasplayer.util.Map] Frame 0
class com.midasplayer.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var _local3 in init) {
map["@" + _local3] = init[_local3];
}
lastSize = -1;
}
function put(key, value) {
map["@" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["@" + key]);
}
function remove(key) {
var _local2 = map["@" + key];
delete map["@" + key];
lastSize = -1;
return(_local2);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var _local2 in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var _local3 in map) {
_local2 = _local2 + "x";
_local2 = _local2 + (((_local3 + "=>") + map[_local3]) + newline);
}
trace(_local2);
}
function toArray() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = map[_local3];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = _local3.substring(1);
}
return(_local2);
}
function foreach(fn) {
do {
if ((in map) == null) {
break;
}
var _local3 = in map;
} while (fn(_local3.substring(1), map[_local3]) != false);
do {
} while ("foreach" != null);
lastSize = -1;
}
}
Symbol 150 MovieClip [__Packages.com.midasplayer.util.ArrayList] Frame 0
class com.midasplayer.util.ArrayList
{
var value;
function ArrayList () {
value = new Array();
}
function insert(obj, pos) {
var _local3 = value.length;
if (pos == undefined) {
value.push(obj);
return(_local3);
}
if (pos > _local3) {
pos = _local3;
}
var _local2 = _local3 - 1;
while (_local2 > (pos - 1)) {
value[_local2 + 1] = value[_local2];
_local2--;
}
value[pos] = obj;
return(pos);
}
function get(pos) {
return(value[pos]);
}
function indexOf(obj) {
var _local2 = 0;
while (_local2 < value.length) {
if (obj == value[_local2]) {
return(_local2);
}
_local2++;
}
return(-1);
}
function remove(obj) {
return(removeByIndex(indexOf(obj)));
}
function removeByIndex(pos) {
var _local5;
var _local3 = value.length;
if ((pos < _local3) && (pos >= 0)) {
_local5 = value[pos];
delete value[pos];
var _local2 = pos;
while (_local2 < (_local3 - 1)) {
value[_local2] = value[_local2 + 1];
_local2++;
}
value.length = _local3 - 1;
}
return(_local5);
}
function size() {
return(value.length);
}
function clear() {
value = new Array();
}
function toArray() {
return(value);
}
function foreach(fn) {
var _local2 = 0;
var _local3 = value.length;
while (_local2 < _local3) {
if (fn(_local2, value[_local2]) == false) {
break;
}
_local2++;
}
}
function sortOn(field) {
value.sortOn(field);
}
function sort() {
value.sort();
}
function subList(from, to) {
if (!to) {
to = value.length;
}
var _local3 = new com.midasplayer.util.ArrayList();
var _local2 = from;
while (_local2 < to) {
_local3.insert(get(_local2));
_local2++;
}
return(_local3);
}
}
Symbol 151 MovieClip [__Packages.com.midasplayer.util.Log] Frame 0
class com.midasplayer.util.Log
{
function Log () {
}
static function setLevel(level) {
level_ = level;
}
static function debug(msg) {
if (level_ <= LEVEL_DEBUG) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_DEBUG, msg));
}
}
static function warning(msg) {
if (level_ <= LEVEL_WARNING) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_WARNING, msg));
}
}
static function error(msg) {
if (level_ <= LEVEL_ERROR) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_ERROR, msg));
}
}
static function getLog() {
if (log_.size() != logStringLastUpdatedSize_) {
logString_ = "";
var _local1 = 0;
while (_local1 < log_.size()) {
var _local2 = com.midasplayer.util.LogEntry(log_.get(_local1));
if (_local1 > 0) {
logString_ = logString_ + newline;
}
logString_ = logString_ + LEVEL_STRINGS[_local2.getLevel()];
logString_ = logString_ + ": ";
logString_ = logString_ + _local2.getMessage();
logStringLastUpdatedSize_ = log_.size();
_local1++;
}
}
return(logString_);
}
static var LEVEL_ALL = -1;
static var LEVEL_NONE = 1000;
static var LEVEL_DEBUG = 0;
static var LEVEL_WARNING = 1;
static var LEVEL_ERROR = 2;
static var LEVEL_STRINGS = ["DEBUG", "WARNING", "ERROR"];
static var level_ = LEVEL_ALL;
static var log_ = new com.midasplayer.util.ArrayList();
static var logString_ = "";
static var logStringLastUpdatedSize_ = 0;
}
Symbol 152 MovieClip [__Packages.com.midasplayer.util.LogEntry] Frame 0
class com.midasplayer.util.LogEntry
{
var level_, message_;
function LogEntry (level, msg) {
level_ = level;
message_ = msg;
}
function getLevel() {
return(level_);
}
function getMessage() {
return(message_);
}
}
Symbol 153 MovieClip [__Packages.com.midasplayer.util.I18n] Frame 0
class com.midasplayer.util.I18n
{
function I18n () {
}
static function addTranslation(name, val) {
val = val.split("'").join("'");
val = val.split("\r\n").join(newline);
translations_.put(name, val);
}
static function format(name, replace0, replace1, replace2) {
var _local3 = translations_.get(name);
if (_local3 == undefined) {
return(("{" + name) + "}");
}
var _local1 = _local3.toString();
if (replace0 != undefined) {
var _local2 = _local1.split("{0}");
_local1 = _local2.join(replace0);
if (replace1 != undefined) {
_local2 = _local1.split("{1}");
_local1 = _local2.join(replace1);
if (replace2 != undefined) {
_local2 = _local1.split("{2}");
_local1 = _local2.join(replace2);
}
}
}
return(_local1);
}
static var translations_ = new com.midasplayer.util.Map();
}
Symbol 154 MovieClip [__Packages.com.midasplayer.game.mahjongmasquerade.Game] Frame 0
class com.midasplayer.game.mahjongmasquerade.Game extends com.midasplayer.util.GameBase
{
static var score_, roundNum_, relaxRoundNum_, maxTime_, random_, clock_, boardLayer_, gameEnded_, board_, animId_, timeLeft_, quitIntervalId_;
var init;
function Game () {
super();
Stage.showMenu = false;
Stage.scaleMode = "noScale";
_root._quality = "best";
_root._focusrect = false;
com.midasplayer.util.GameBase.setGameMode(_root.gamemode);
com.midasplayer.util.Log.setLevel(com.midasplayer.util.Log.LEVEL_NONE);
init(this);
}
function startGame() {
score_ = 0;
roundNum_ = 1;
com.midasplayer.fx.SoundManager.enableSounds(true);
if (com.midasplayer.util.GameBase.gameData.get("relaxMode") == "true") {
trace("relax mode");
com.midasplayer.util.GameBase.relaxMode_ = true;
relaxRoundNum_ = 1;
} else {
maxTime_ = Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".time"));
}
random_ = new com.midasplayer.util.Random(Number(com.midasplayer.util.GameBase.gameData.get("seed")));
_root.attachMovie("top", "top", _root.getNextHighestDepth());
if (!com.midasplayer.util.GameBase.relaxMode_) {
clock_ = new com.midasplayer.game.mahjongmasquerade.Clock(_root);
}
boardLayer_ = _root.createEmptyMovieClip("boardlayer", _root.getNextHighestDepth());
_root.attachMovie("bar", "bar", _root.getNextHighestDepth());
_root.bar._x = 0;
_root.bar._y = 0;
displayScore();
displayLevel();
_root.attachMovie("lowerbar", "lowerbar", _root.getNextHighestDepth());
_root.lowerbar._y = 570;
_root.lowerbar._x = 32;
_root.lowerbar.endgame.text = com.midasplayer.util.I18n.format("end_game");
_root.lowerbar.sound.text = com.midasplayer.util.I18n.format("sound_off");
_root.lowerbar.soundbtn.onRelease = function () {
com.midasplayer.game.mahjongmasquerade.Game.switchSound();
};
_root.lowerbar.endgamebtn.onRelease = function () {
com.midasplayer.game.mahjongmasquerade.Game.endGamePressed();
};
com.midasplayer.util.GameBase.reportGameStart();
com.midasplayer.util.GameBase.reportPlayData(19, VERSION, "0");
showInstructions();
}
static function isDeluxe() {
if (com.midasplayer.util.GameBase.relaxMode_) {
return(true);
}
var _local1 = com.midasplayer.util.GameBase.gameData.get("mode");
return(_local1 == "deluxe");
}
static function switchSound() {
var _local2 = com.midasplayer.fx.SoundManager.isSoundEnabled();
com.midasplayer.fx.SoundManager.enableSounds(!_local2);
if (_local2) {
_root.lowerbar.sound.text = com.midasplayer.util.I18n.format("sound_on");
_root.lowerbar.soundbtn.gotoAndStop(5);
} else {
_root.lowerbar.sound.text = com.midasplayer.util.I18n.format("sound_off");
}
}
static function endGamePressed() {
if (gameEnded_) {
return(undefined);
}
gameEndPressed_ = true;
_root.lowerbar.endgame.onRelease = undefined;
_root.lowerbar.endgame.useHandCursor = false;
if (!board_.isStopped()) {
board_.stop();
}
com.midasplayer.util.AnimPlayer.stop(animId_);
com.midasplayer.fx.SoundManager.stopAll();
com.midasplayer.util.GameBase.reportPlayData(177, "", "0");
_root.game.gameOver();
}
function showInstructions() {
com.midasplayer.fx.SoundManager.play("snd_intro", 100);
_root.attachMovie("instructions", "instructions", _root.getNextHighestDepth());
_root.instructions._x = 24;
_root.instructions._y = 65;
_root.instructions.header.text = com.midasplayer.util.I18n.format("instructions_header");
_root.instructions.text1.text = com.midasplayer.util.I18n.format("instructions_text");
_root.instructions.starts_in.text = com.midasplayer.util.I18n.format("instructions_game_starts", "10");
_root.instructions.moves.text = com.midasplayer.util.I18n.format("instructions_moves");
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showInstructionsAnim}], callback:endShowInstructions, callback_scope:this, tps:50});
}
function showInstructionsAnim(tick, alpha) {
var _local3 = false;
var _local4 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 500);
var _local5 = Math.ceil(10 - (_local4 * 10));
_root.instructions.starts_in.text = com.midasplayer.util.I18n.format("instructions_game_starts", "" + _local5);
if (((tick > 25) && (_root.instructions.onPress == undefined)) && (!gameEndPressed_)) {
_root.instructions.onPress = function () {
this.clicked = true;
};
_root.instructions.click.text = com.midasplayer.util.I18n.format("instructions_click");
}
if ((_local4 == 1) || (_root.instructions.clicked)) {
_local3 = true;
}
return(_local3);
}
function endShowInstructions() {
if (gameEndPressed_) {
return(undefined);
}
_root.instructions.removeMovieClip();
startRound();
}
function startRound() {
com.midasplayer.fx.SoundManager.stop("snd_intro");
com.midasplayer.fx.SoundManager.stop("snd_clear");
com.midasplayer.fx.SoundManager.play("snd_start", 100, false, function () {
com.midasplayer.fx.SoundManager.play("snd_loop", 50, true);
});
displayLevel();
maxTime_ = Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".time"));
var _local4 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".cols"));
var _local2 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".rows"));
var _local3 = com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".types");
clock_.setMaxTime(maxTime_);
com.midasplayer.util.GameBase.reportPlayData(132, "", "0");
board_ = new com.midasplayer.game.mahjongmasquerade.Board(this, roundNum_, boardLayer_, random_.nextInt(1000000), _local4, _local2, _local3);
board_.start();
}
function anyMoreRounds() {
var _local1 = roundNum_ + 1;
var _local2 = com.midasplayer.util.GameBase.gameData.get(("level." + _local1) + ".time");
return(_local2 != undefined);
}
function endRound() {
com.midasplayer.fx.SoundManager.stop("snd_loop");
com.midasplayer.fx.SoundManager.stop("snd_time");
com.midasplayer.fx.SoundManager.stop("snd_time2");
if (gameEnded_) {
return(undefined);
}
if ((!com.midasplayer.util.GameBase.relaxMode_) && (!anyMoreRounds())) {
gameOver(true);
} else {
board_.remove();
showRoundEnded();
}
}
function showRoundEnded() {
com.midasplayer.fx.SoundManager.play("snd_clear", 100);
var _local3 = 0;
if (!com.midasplayer.util.GameBase.relaxMode_) {
_local3 = getTimeBonusScore();
com.midasplayer.util.GameBase.reportPlayData(331, "" + timeLeft_, "" + _local3);
addScore(_local3);
}
_root.attachMovie("sign", "sign", _root.getNextHighestDepth());
_root.sign.rose._visible = false;
_root.sign.gotoAndStop(1);
_root.sign._x = 211;
_root.sign._y = 260;
var _local4 = ((board_ == undefined) ? 8 : (Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".rows"))));
_local4 = _local4 * com.midasplayer.game.mahjongmasquerade.Tile.HEIGHT;
_root.sign._y = (((_local4 - 310) / 2) + 70) + 175;
_root.sign.txt_score.text = com.midasplayer.util.I18n.format("round_score");
if (com.midasplayer.util.GameBase.relaxMode_) {
_root.sign.header.text = com.midasplayer.util.I18n.format("round_header", "" + relaxRoundNum_);
_root.sign.txt_bonus._visible = false;
_root.sign.bonus._visible = false;
_root.sign.txt_total._visible = false;
_root.sign.total._visible = false;
} else {
_root.sign.header.text = com.midasplayer.util.I18n.format("round_header", "" + roundNum_);
_root.sign.txt_bonus.text = com.midasplayer.util.I18n.format("round_time_bonus");
_root.sign.bonus.text = _local3;
_root.sign.txt_total.text = com.midasplayer.util.I18n.format("round_total_score");
_root.sign.total.text = score_;
}
_root.sign.score.text = score_ - _local3;
_root.sign.starts_in.text = com.midasplayer.util.I18n.format("round_next_level_starts", "10");
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showRoundEndedAnim}], callback:endShowRoundEnded, callback_scope:this, tps:50});
}
function showRoundEndedAnim(tick, alpha) {
var _local3 = false;
var _local4 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 500);
var _local7 = Math.round(24 * com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 50)) + 1;
_root.sign.gotoAndStop(_local7);
var _local6 = Math.ceil(10 - (_local4 * 10));
_root.sign.starts_in.text = com.midasplayer.util.I18n.format("round_next_level_starts", "" + _local6);
if ((tick > 25) && (_root.sign.onPress == undefined)) {
_root.sign.onPress = function () {
this.clicked = true;
};
_root.sign.click.text = com.midasplayer.util.I18n.format("instructions_click");
}
if ((_local4 == 1) || (_root.sign.clicked)) {
_local3 = true;
}
return(_local3);
}
function endShowRoundEnded() {
if (gameEndPressed_) {
return(undefined);
}
if (com.midasplayer.util.GameBase.relaxMode_) {
relaxRoundNum_++;
if (roundNum_ < 3) {
roundNum_++;
}
} else {
roundNum_++;
}
_root.sign.onPress = undefined;
_root.sign.removeMovieClip();
startRound();
}
function gameOver(allCleared) {
com.midasplayer.fx.SoundManager.stop("snd_loop");
com.midasplayer.fx.SoundManager.stop("snd_time");
com.midasplayer.fx.SoundManager.stop("snd_time2");
if (gameEnded_) {
return(undefined);
}
gameEnded_ = true;
showGameOver(allCleared);
}
function showGameOver(allCleared) {
_root.sign.removeMovieClip();
_root.sign.onPress = undefined;
_root.instructions.onPress = undefined;
_root.instructions.useHandCursor = false;
com.midasplayer.fx.SoundManager.play("snd_end", 100);
var _local8 = 0;
if (allCleared) {
_local8 = getTimeBonusScore();
addScore(_local8);
}
if (timeLeft_ == undefined) {
timeLeft_ = 0;
}
com.midasplayer.util.GameBase.reportPlayData(331, "" + timeLeft_, "" + _local8);
if (allCleared && (roundNum_ == 3)) {
var _local7 = 2;
var _local5 = 100;
var _local6 = 40;
_root.stars = new Array();
var _local3 = 0;
while (_local3 < _local7) {
_root.stars[_local3] = new Array();
var _local4 = 0;
while (_local4 < _local5) {
_root.stars[_local3].push(_root.attachMovie("animstar", (("star_" + (_local3 + 1)) + "_") + (_local4 + 1), _root.getNextHighestDepth()));
_root.stars[_local3][_local4].manager = _root.stars[_local3][0];
_root.stars[_local3][_local4].manager.waitcount = _local6 * _local3;
_local4++;
}
_local3++;
}
}
_root.attachMovie("sign", "sign", _root.getNextHighestDepth());
_root.sign.rose._visible = false;
if (allCleared) {
_root.sign.rose._visible = true;
}
_root.sign.gotoAndStop(1);
_root.sign._x = 211;
_root.sign._y = 260;
var _local10 = ((board_ == undefined) ? 8 : (Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".rows"))));
_local10 = _local10 * com.midasplayer.game.mahjongmasquerade.Tile.HEIGHT;
_root.sign._y = (((_local10 - 310) / 2) + 70) + 175;
if (allCleared) {
_root.sign.header.text = com.midasplayer.util.I18n.format("game_over");
} else if (board_.wasNoMoreMoves()) {
_root.sign.header.text = com.midasplayer.util.I18n.format("no_more_moves");
} else if (gameEndPressed_) {
_root.sign.header.text = com.midasplayer.util.I18n.format("game_over");
} else {
_root.sign.header.text = com.midasplayer.util.I18n.format("time_out");
}
var _local9 = new Array();
if (board_.anyMoreMoves()) {
board_.showPossibleMove();
_root.sign._visible = false;
_local9.push([{obj:this, func:showPossibleMoveAnim}]);
}
if (com.midasplayer.util.GameBase.relaxMode_) {
_root.sign.txt_score.text = com.midasplayer.util.I18n.format("level");
_root.sign.score.text = relaxRoundNum_;
_root.sign.txt_bonus.text = com.midasplayer.util.I18n.format("round_score");
_root.sign.bonus.text = score_;
_root.sign.total._visible = false;
_root.sign.txt_total._visible = false;
} else {
_root.sign.txt_score.text = com.midasplayer.util.I18n.format("round_score");
_root.sign.txt_bonus.text = com.midasplayer.util.I18n.format("round_time_bonus");
_root.sign.txt_total.text = com.midasplayer.util.I18n.format("round_total_score");
_root.sign.score.text = score_ - _local8;
_root.sign.bonus.text = _local8;
_root.sign.total.text = score_;
}
_root.sign.starts_in.text = com.midasplayer.util.I18n.format("game_ends", "10");
_local9.push([{obj:this, func:showGameOverAnim}]);
com.midasplayer.util.AnimPlayer.play({playlist:_local9, callback:endShowGameOver, callback_scope:this, tps:50});
}
function showPossibleMoveAnim(tick, alpha) {
var _local3 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 120);
var _local4 = (Math.sin(_local3 * 9) * 40) + 60;
var _local2 = board_.getLineLayer();
_local2._alpha = _local4;
if (_local3 == 1) {
_root.sign._visible = true;
_local2._alpha = 0;
return(true);
}
return(false);
}
function showGameOverAnim(tick) {
var _local3 = false;
var _local4 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 500);
var _local6 = Math.ceil(10 - (_local4 * 10));
var _local7 = Math.round(24 * com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 50)) + 1;
_root.sign.gotoAndStop(_local7);
_root.sign.starts_in.text = com.midasplayer.util.I18n.format("game_ends", "" + _local6);
if ((tick > 25) && (_root.sign.onPress == undefined)) {
_root.sign.onPress = function () {
this.clicked = true;
};
_root.sign.click.text = com.midasplayer.util.I18n.format("instructions_click");
}
if ((_local4 == 1) || (_root.sign.clicked)) {
_local3 = true;
}
return(_local3);
}
function endShowGameOver() {
endGame();
}
static function endGame() {
trace("gameEnd score_" + score_);
com.midasplayer.util.GameBase.reportGameEnd(score_);
quitIntervalId_ = setInterval(quitGame, 1600);
}
static function quitGame() {
clearInterval(quitIntervalId_);
com.midasplayer.fx.SoundManager.stopAll();
com.midasplayer.util.GameBase.reportGameQuit();
}
static function getTimeBonusScore() {
var _local2 = timeLeft_ / maxTime_;
var _local1 = 0;
if (roundNum_ == 1) {
_local1 = 500 * _local2;
} else if (roundNum_ == 2) {
_local1 = 1000 * _local2;
} else if (roundNum_ == 3) {
_local1 = 1500 * _local2;
}
return(Math.round(_local1));
}
static function addScore(score) {
score_ = score_ + score;
score_ = ((score_ < 0) ? 0 : (score_));
displayScore();
}
static function displayScore() {
_root.bar.score.text = score_;
_root.bar.score2.text = score_;
}
static function displayLevel() {
_root.bar.level.gotoAndStop(roundNum_);
}
static function setTime(t) {
timeLeft_ = maxTime_ - Math.round(t);
clock_.setTime(t);
}
static function getMaxTime() {
return(maxTime_);
}
static function isRelaxMode() {
return(com.midasplayer.util.GameBase.relaxMode_);
}
static var VERSION = "1.01";
static var gameEndPressed_ = false;
}
Symbol 155 MovieClip [__Packages.com.midasplayer.util.Random] Frame 0
class com.midasplayer.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.midasplayer.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = _local3.lsb + mti);
mti++;
}
var _local6 = getTimer();
}
function genrand_int32() {
var _local3 = 0;
if (mti >= N) {
if (mti == (N + 1)) {
init_genrand(5489);
}
var _local2 = 0;
_local2 = 0;
while (_local2 < (N - M)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + M] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
while (_local2 < (N - 1)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + (M - N)] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
_local3 = (mta[N - 1] & UPPER_MASK) | (mta[0] & LOWER_MASK);
mta[N - 1] = (mta[M - 1] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
mti = 0;
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = 2567483615;
static var UPPER_MASK = 2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, 2567483615];
}
Symbol 156 MovieClip [__Packages.com.midasplayer.util.Integer64] Frame 0
class com.midasplayer.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
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 (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.midasplayer.util.Integer64(value));
}
function toString() {
return(((((("Integer64[value=0x" + com.midasplayer.util.Numbers.dec2hex(msb)) + ":") + com.midasplayer.util.Numbers.dec2hex(lsb)) + ":(") + p) + ")]");
}
function merge(a) {
var _local2 = 0;
while (_local2 < 3) {
p[_local2] = p[_local2] + (a & 32767);
a = a >>> 15;
_local2++;
}
return(a);
}
function shl() {
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
var _local3 = p.length;
while (_local2 < _local3) {
_local5 = (p[_local2] & 16384) >> 14;
p[_local2] = p[_local2] << 1;
p[_local2] = (p[_local2] | _local4) & 32767;
_local2++;
_local4 = _local5;
}
}
function shr() {
var _local4 = 0;
var _local3 = 0;
var _local2 = p.length - 1;
while (_local2 >= 0) {
_local4 = (p[_local2] & 1) << 14;
p[_local2] = p[_local2] >> 1;
p[_local2] = (p[_local2] | _local3) & 32767;
_local2--;
_local3 = _local4;
}
}
static var MASK = 32767;
static var SH = 15;
}
Symbol 157 MovieClip [__Packages.com.midasplayer.util.Numbers] Frame 0
class com.midasplayer.util.Numbers
{
function Numbers () {
}
static function dec2hex(iValue, padding) {
var _local1 = "";
while (iValue != 0) {
_local1 = "0123456789abcdef".charAt(iValue & 15) + _local1;
iValue = iValue >>> 4;
}
if (padding) {
if (_local1.length == 0) {
_local1 = "00";
}
if (_local1.length < 2) {
_local1 = "0" + _local1;
}
} else if (_local1.length == 0) {
_local1 = "0";
}
return(_local1);
}
static function itoa(value, numZeroPadding) {
var _local2 = "" + value;
if (numZeroPadding) {
var _local1 = numZeroPadding - 1;
while (_local1 > 0) {
if (value < Math.pow(10, _local1)) {
_local2 = "0" + _local2;
}
_local1--;
}
}
return(_local2);
}
static function asTime(millis, alwaysHours, alwaysMinutes) {
if (alwaysHours) {
alwaysMinutes = true;
}
if (millis < 0) {
millis = 0;
}
millis = millis / 1000;
millis = Math.floor(millis);
var _local3 = Math.floor(millis / 3600);
var _local4 = Math.floor(millis / 60) % 60;
var _local5 = millis % 60;
var _local1 = "";
if (alwaysHours || (_local3 > 0)) {
_local1 = _local1 + itoa(_local3, 2);
}
if (alwaysHours || (_local1.length > 0)) {
_local1 = _local1 + ":";
}
var _local6 = _local1.length;
if ((alwaysMinutes || (_local4 > 0)) || (_local3 > 0)) {
_local1 = _local1 + itoa(_local4, 2);
}
if (alwaysMinutes || (_local1.length != _local6)) {
_local1 = _local1 + ":";
}
return(_local1 + itoa(_local5, 2));
}
}
Symbol 158 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
interface com.midasplayer.timing.Timeable
{
}
Symbol 159 MovieClip [__Packages.com.midasplayer.game.mahjongmasquerade.Board] Frame 0
class com.midasplayer.game.mahjongmasquerade.Board implements com.midasplayer.timing.Timeable
{
static var random_;
var game_, level_, clip_, seed_, cols_, rows_, tileTypes_, numClearedPairs_, lastScore_, gridClip_, tileLayer_, lineLayer_, boardX_, boardY_, tiles_, numTilesLeft_, tilesByType_, timer_, stopped_, handleClick_, foundTile1_, foundTile2_, lastTick_;
function Board (game, level, clip, seed, cols, rows, tileTypes) {
game_ = game;
level_ = level;
clip_ = clip;
seed_ = seed;
cols_ = cols + 2;
rows_ = rows + 2;
tileTypes_ = tileTypes;
numClearedPairs_ = 0;
lastScore_ = 0;
random_ = new com.midasplayer.util.Random(seed_);
initLayers();
initTiles();
}
function initLayers() {
_root.boardlayer.grid.removeMovieClip();
gridClip_ = clip_.attachMovie((("grid_" + (cols_ - 2)) + "x") + (rows_ - 2), "grid", clip_.getNextHighestDepth());
gridClip_._x = (Stage.width - gridClip_._width) / 2;
gridClip_._y = 70;
tileLayer_ = clip_.createEmptyMovieClip("tilelayer", clip_.getNextHighestDepth());
lineLayer_ = clip_.createEmptyMovieClip("linelayer", clip_.getNextHighestDepth());
boardX_ = (gridClip_._x + 24) - com.midasplayer.game.mahjongmasquerade.Tile.WIDTH;
boardY_ = (gridClip_._y + 22) - com.midasplayer.game.mahjongmasquerade.Tile.HEIGHT;
}
function getLineLayer() {
return(lineLayer_);
}
function initTiles() {
var _local10 = new com.midasplayer.util.ArrayList();
var _local16 = new com.midasplayer.util.StringTokenizer(tileTypes_, "+");
var _local3 = 0;
while (_local16.hasMoreTokens()) {
var _local11 = _local16.nextToken();
var _local13 = _local11.indexOf("*", 0);
var _local14 = _local11.substring(0, _local13);
var _local12 = _local11.substring(_local13 + 1, _local11.length);
var _local9 = 0;
while (_local9 < _local14) {
var _local6 = 0;
while (_local6 < _local12) {
_local10.insert(_local3);
_local6++;
}
_local3++;
_local9++;
}
}
var _local21 = _local3;
var _local20 = _root.attachMovie("tile", "testtile", _root.getNextHighestDepth());
_local20._visible = false;
var _local19 = com.midasplayer.game.mahjongmasquerade.Tile.NUM_TILES;
_local20.removeMovieClip();
var _local15 = 0;
if (level_ == 2) {
_local15 = (_local19 - _local3) >> 1;
}
if (level_ == 3) {
_local15 = _local19 - _local3;
}
tiles_ = new Array();
var _local7 = 0;
while (_local7 < rows_) {
tiles_[_local7] = new Array();
_local7++;
}
if (com.midasplayer.game.mahjongmasquerade.Game.isDeluxe()) {
var _local18;
var _local17;
if (level_ == 1) {
_local18 = random_.nextInt(6);
_local17 = random_.nextInt(2);
insertObstacle(_local18, _local17);
} else if (level_ == 2) {
_local18 = random_.nextInt(2);
_local17 = random_.nextInt(2);
insertObstacle(_local18, _local17);
_local18 = random_.nextInt(2) + 6;
_local17 = random_.nextInt(2);
insertObstacle(_local18, _local17);
} else if (level_ == 3) {
_local18 = 0;
_local17 = random_.nextInt(4);
insertObstacle(_local18, _local17);
_local18 = 4;
_local17 = random_.nextInt(4);
insertObstacle(_local18, _local17);
_local18 = 8;
_local17 = random_.nextInt(4);
insertObstacle(_local18, _local17);
}
}
var _local18 = boardX_;
var _local17 = boardY_;
numTilesLeft_ = 0;
tilesByType_ = new Array();
_local7 = 0;
while (_local7 < rows_) {
var _local4 = 0;
while (_local4 < cols_) {
if (tiles_[_local7][_local4] != undefined) {
trace("found");
} else {
var _local8;
if ((((_local7 == 0) || (_local4 == 0)) || (_local7 == (rows_ - 1))) || (_local4 == (cols_ - 1))) {
_local8 = -1;
_local3 = 0;
} else {
_local8 = random_.nextInt(_local10.size());
_local3 = Number(_local10.removeByIndex(_local8));
_local3 = _local3 + (_local15 + 1);
}
var _local5 = new com.midasplayer.game.mahjongmasquerade.Tile(this, tileLayer_, _local3, _local7, _local4);
_local5.setX(_local18 + (_local4 * com.midasplayer.game.mahjongmasquerade.Tile.WIDTH));
_local5.setY(_local17 + (_local7 * com.midasplayer.game.mahjongmasquerade.Tile.HEIGHT));
tiles_[_local7][_local4] = _local5;
if (_local3 > 0) {
if (tilesByType_[_local3] == undefined) {
tilesByType_[_local3] = new Array();
}
tilesByType_[_local3][tilesByType_[_local3].length] = _local5;
}
numTilesLeft_++;
}
_local4++;
}
_local7++;
}
_local7 = 0;
while (_local7 < rows_) {
var _local4 = 0;
while (_local4 < cols_) {
if ((((_local7 == 0) || (_local4 == 0)) || (_local7 == (rows_ - 1))) || (_local4 == (cols_ - 1))) {
removeTile(tiles_[_local7][_local4]);
numTilesLeft_--;
}
_local4++;
}
_local7++;
}
}
function insertObstacle(x, y) {
var _local6 = random_.nextInt(5);
x++;
y++;
var _local9 = random_.nextInt(2);
var _local2 = 0;
while (_local2 < 4) {
if (_local9 == 0) {
var _local5 = x + obstacles_[_local6][_local2][0];
var _local4 = y + obstacles_[_local6][_local2][1];
} else {
var _local5 = x + obstacles_[_local6][_local2][1];
var _local4 = y + obstacles_[_local6][_local2][0];
}
var _local3 = new com.midasplayer.game.mahjongmasquerade.Tile(this, tileLayer_, com.midasplayer.game.mahjongmasquerade.Tile.WALL_TYPE, _local4, _local5);
_local3.setX(boardX_ + (_local5 * com.midasplayer.game.mahjongmasquerade.Tile.WIDTH));
_local3.setY(boardY_ + (_local4 * com.midasplayer.game.mahjongmasquerade.Tile.HEIGHT));
tiles_[_local4][_local5] = _local3;
_local2++;
}
}
function initTimer() {
timer_ = new com.midasplayer.timing.Timer(this, TPS);
clip_.timer = timer_;
clip_.onEnterFrame = function () {
this.timer.advanceTime();
};
}
function removeTimer() {
clip_.onEnterFrame = undefined;
delete timer_;
}
function remove() {
removeTimer();
tileLayer_.removeMovieClip();
lineLayer_.removeMovieClip();
}
function start() {
initTimer();
var _local3 = 1;
while (_local3 < (rows_ - 1)) {
var _local2 = 1;
while (_local2 < (cols_ - 1)) {
tiles_[_local3][_local2].setClickable(true);
_local2++;
}
_local3++;
}
}
function isStopped() {
return(stopped_);
}
function stop() {
Mouse.removeListener(this);
stopped_ = true;
var _local3 = 1;
while (_local3 < (rows_ - 1)) {
var _local2 = 1;
while (_local2 < (cols_ - 1)) {
tiles_[_local3][_local2].setClickable(false);
_local2++;
}
_local3++;
}
}
function gameOver() {
stop();
_root.game.gameOver();
}
function endRound() {
stop();
_root.game.endRound();
}
function noMoreMoves() {
stop();
noMoreMoves_ = true;
com.midasplayer.util.AnimPlayer.delay({millis:1500, callback:gameOver, callback_scope:_root.game});
}
function wasNoMoreMoves() {
return(noMoreMoves_);
}
function tileClicked(tile) {
if (handleClick_) {
return(undefined);
}
handleClick_ = true;
com.midasplayer.fx.SoundManager.play("snd_mark", 100);
if (clickedTile_ == null) {
clickedTile_ = tile;
tile.markClicked();
handleClick_ = false;
} else if (clickedTile_ == tile) {
clickedTile_ = null;
tile.unmarkClicked();
handleClick_ = false;
} else {
clickedTile_.unmarkClicked();
findPath(clickedTile_, tile);
}
}
function endFindPath(validPath, tile1, tile2) {
if (validPath) {
numClearedPairs_++;
var _local4 = 9 + (1 * numClearedPairs_);
lastScore_ = _local4;
com.midasplayer.game.mahjongmasquerade.Game.addScore(_local4);
com.midasplayer.util.GameBase.reportPlayData(58, (((((("" + tile1.getCol()) + " ") + tile1.getRow()) + " ") + tile2.getCol()) + " ") + tile2.getRow(), "" + _local4);
removeTile(tile1);
removeTile(tile2);
numTilesLeft_--;
numTilesLeft_--;
if (numTilesLeft_ == 0) {
endRound();
return(undefined);
}
if (!anyMoreMoves()) {
noMoreMoves();
return(undefined);
}
clickedTile_ = null;
} else {
var _local4 = -lastScore_;
com.midasplayer.game.mahjongmasquerade.Game.addScore(_local4);
com.midasplayer.util.GameBase.reportPlayData(59, (((((("" + tile1.getCol()) + " ") + tile1.getRow()) + " ") + tile2.getCol()) + " ") + tile2.getRow(), "" + _local4);
clickedTile_.unmarkClicked();
clickedTile_ = null;
}
handleClick_ = false;
}
function anyMoreMoves() {
var _local3 = false;
var _local2 = 1;
while (_local2 < 50) {
if (existsPathWithType(_local2)) {
_local3 = true;
break;
}
_local2++;
}
return(_local3);
}
function existsPathWithType(type) {
var _local9 = tilesByType_[type];
if (_local9 == undefined) {
return(false);
}
var _local7 = _local9.length;
var _local4;
var _local3;
var _local8 = false;
var _local5 = 0;
while (_local5 < (_local7 - 1)) {
var _local2 = _local5 + 1;
while (_local2 < _local7) {
_local4 = tilesByType_[type][_local5];
_local3 = tilesByType_[type][_local2];
if ((!_local4.isRemoved()) && (!_local3.isRemoved())) {
if (existsPath(_local4, _local3)) {
foundTile1_ = _local4;
foundTile2_ = _local3;
_local8 = true;
break;
}
}
_local2++;
}
_local5++;
}
return(_local8);
}
function showPossibleMove() {
if (anyMoreMoves()) {
findPath(foundTile1_, foundTile2_, true);
}
}
function existsPath(tile1, tile2) {
var _local9 = tile1.getCol();
var _local8 = tile1.getRow();
var _local13 = tile2.getCol();
var _local12 = tile2.getRow();
var _local7 = _local13 - _local9;
var _local6 = _local12 - _local8;
if (((_local9 == _local13) && (tile1.isFreeExclusive(0, _local6))) || ((_local8 == _local12) && (tile1.isFreeExclusive(_local7, 0)))) {
return(true);
}
if (tile1.isFree(0, _local6) && (tile2.isFree(-_local7, 0))) {
return(true);
}
if (tile1.isFree(_local7, 0) && (tile2.isFree(0, -_local6))) {
return(true);
}
var _local11 = Math.max(rows_, cols_);
var _local2 = 1;
while (_local2 < _local11) {
var _local4 = 0;
if ((tile1.isFree(_local2, 0) && (tile2.isFree((-_local7) + _local2, 0))) && (tiles_[_local8][_local9 + _local2].isFree(0, _local6))) {
_local4 = _local2;
} else if ((tile1.isFree(-_local2, 0) && (tile2.isFree((-_local7) - _local2, 0))) && (tiles_[_local8][_local9 - _local2].isFree(0, _local6))) {
_local4 = -_local2;
}
if (_local4 != 0) {
return(true);
}
var _local3 = 0;
if ((tile1.isFree(0, _local2) && (tile2.isFree(0, (-_local6) + _local2))) && (tiles_[_local8 + _local2][_local9].isFree(_local7, 0))) {
_local3 = _local2;
} else if ((tile1.isFree(0, -_local2) && (tile2.isFree(0, (-_local6) - _local2))) && (tiles_[_local8 - _local2][_local9].isFree(_local7, 0))) {
_local3 = -_local2;
}
if (_local3 != 0) {
return(true);
}
_local2++;
}
return(false);
}
function findPath(tile1, tile2, showPossibleMove) {
if (tile1.getType() != tile2.getType()) {
findNonValidPath(tile1, tile2);
return(false);
}
var _local4 = tile1.getCol();
var _local3 = tile1.getRow();
var _local14 = tile2.getCol();
var _local13 = tile2.getRow();
var _local11 = _local14 - _local4;
var _local10 = _local13 - _local3;
if (((_local4 == _local14) && (tile1.isFreeExclusive(0, _local10))) || ((_local3 == _local13) && (tile1.isFreeExclusive(_local11, 0)))) {
var _local9 = new com.midasplayer.game.mahjongmasquerade.LineConnector(this, lineLayer_, showPossibleMove);
_local9.addTile(tile1);
_local9.addTile(tile2);
_local9.draw();
return(true);
}
if (tile1.isFree(0, _local10) && (tile2.isFree(-_local11, 0))) {
var _local9 = new com.midasplayer.game.mahjongmasquerade.LineConnector(this, lineLayer_, showPossibleMove);
_local9.addTile(tile1);
_local9.addTile(tiles_[_local3 + _local10][_local4]);
_local9.addTile(tile2);
_local9.draw();
return(true);
}
if (tile1.isFree(_local11, 0) && (tile2.isFree(0, -_local10))) {
var _local9 = new com.midasplayer.game.mahjongmasquerade.LineConnector(this, lineLayer_, showPossibleMove);
_local9.addTile(tile1);
_local9.addTile(tiles_[_local3][_local4 + _local11]);
_local9.addTile(tile2);
_local9.draw();
return(true);
}
var _local15 = Math.max(rows_, cols_);
var _local2 = 1;
while (_local2 < _local15) {
var _local8 = 0;
if ((tile1.isFree(_local2, 0) && (tile2.isFree((-_local11) + _local2, 0))) && (tiles_[_local3][_local4 + _local2].isFree(0, _local10))) {
_local8 = _local2;
} else if ((tile1.isFree(-_local2, 0) && (tile2.isFree((-_local11) - _local2, 0))) && (tiles_[_local3][_local4 - _local2].isFree(0, _local10))) {
_local8 = -_local2;
}
if (_local8 != 0) {
var _local9 = new com.midasplayer.game.mahjongmasquerade.LineConnector(this, lineLayer_, showPossibleMove);
_local9.addTile(tile1);
_local9.addTile(tiles_[_local3][_local4 + _local8]);
_local9.addTile(tiles_[_local13][_local4 + _local8]);
_local9.addTile(tile2);
_local9.draw();
return(true);
}
var _local7 = 0;
if ((tile1.isFree(0, _local2) && (tile2.isFree(0, (-_local10) + _local2))) && (tiles_[_local3 + _local2][_local4].isFree(_local11, 0))) {
_local7 = _local2;
} else if ((tile1.isFree(0, -_local2) && (tile2.isFree(0, (-_local10) - _local2))) && (tiles_[_local3 - _local2][_local4].isFree(_local11, 0))) {
_local7 = -_local2;
}
if (_local7 != 0) {
var _local9 = new com.midasplayer.game.mahjongmasquerade.LineConnector(this, lineLayer_, showPossibleMove);
_local9.addTile(tile1);
_local9.addTile(tiles_[_local3 + _local7][_local4]);
_local9.addTile(tiles_[_local3 + _local7][_local14]);
_local9.addTile(tile2);
_local9.draw();
return(true);
}
_local2++;
}
if (showPossibleMove) {
return(true);
}
findNonValidPath(tile1, tile2);
return(false);
}
function findNonValidPath(tile1, tile2) {
trace("findNonValidPath - start");
var _local15 = tile2.getCol();
var _local14 = tile2.getRow();
var _local3 = 0;
while (_local3 < rows_) {
var _local4 = 0;
while (_local4 < cols_) {
tiles_[_local3][_local4].nv = 0;
tiles_[_local3][_local4].d = 0;
tiles_[_local3][_local4].md = 2 * (Math.abs(_local15 - _local4) + Math.abs(_local14 - _local3));
tiles_[_local3][_local4].heapValue = 0;
tiles_[_local3][_local4].closed = false;
_local4++;
}
_local3++;
}
var _local12 = false;
var _local8 = tile1;
var _local6 = new com.midasplayer.util.BinaryHeap();
tile1.heapValue = tile1.md;
tile1.parent = undefined;
_local6.insert(tile1);
var _local17 = 0;
while (!_local12) {
_local17++;
var _local9 = com.midasplayer.game.mahjongmasquerade.Tile(_local6.removeMin());
_local9.closed = true;
var _local4 = _local9.getCol();
_local3 = _local9.getRow();
if (_local9.md == 2) {
_local8 = tile2;
tile2.parent = _local9;
if ((_local9.parent.getCol() == tile2.getCol()) || (_local9.parent.getRow() == tile2.getRow())) {
tile2.nv = _local9.nv;
} else {
tile2.nv = _local9.nv + 1;
}
_local12 = true;
break;
}
if ((_local8.nv > 2) || (_local9.nv == _local8.nv)) {
if (_local9.md < _local8.md) {
_local8 = _local9;
}
} else if (_local9.nv > _local8.nv) {
_local8 = _local9;
}
var _local5;
_local5 = _local9.getNumFreeUp();
_local5 = ((_local9.getNumFreeUp() >= 1) ? 1 : 0);
var _local11 = 1;
while (_local11 <= _local5) {
var _local2 = tiles_[_local3 - _local11][_local4];
var _local18 = ((tiles_[_local3 + 1][_local4] == _local9.parent) ? (_local9.nv) : (_local9.nv + 1));
var _local7 = (((_local18 * 10) + _local9.d) + _local11) + (_local2.md * 2);
if ((!_local2.closed) && ((_local2.heapValue == 0) || (_local2.heapValue > _local7))) {
_local2.heapValue = _local7;
_local2.nv = _local18;
_local2.d = _local9.d + _local11;
_local2.parent = _local9;
_local6.insert(_local2);
}
_local11++;
}
_local5 = _local9.getNumFreeDown();
_local5 = ((_local9.getNumFreeDown() >= 1) ? 1 : 0);
_local11 = 1;
while (_local11 <= _local5) {
var _local2 = tiles_[_local3 + _local11][_local4];
var _local18 = ((tiles_[_local3 - 1][_local4] == _local9.parent) ? (_local9.nv) : (_local9.nv + 1));
var _local7 = (((_local18 * 10) + _local9.d) + _local11) + (_local2.md * 2);
if ((!_local2.closed) && ((_local2.heapValue == 0) || (_local2.heapValue > _local7))) {
_local2.heapValue = _local7;
_local2.nv = _local18;
_local2.d = _local9.d + _local11;
_local2.parent = _local9;
_local6.insert(_local2);
}
_local11++;
}
_local5 = _local9.getNumFreeRight();
_local5 = ((_local9.getNumFreeRight() >= 1) ? 1 : 0);
_local11 = 1;
while (_local11 <= _local5) {
var _local2 = tiles_[_local3][_local4 + _local11];
var _local18 = ((tiles_[_local3][_local4 - _local11] == _local9.parent) ? (_local9.nv) : (_local9.nv + 1));
var _local7 = (((_local18 * 10) + _local9.d) + _local11) + (_local2.md * 2);
if ((!_local2.closed) && ((_local2.heapValue == 0) || (_local2.heapValue > _local7))) {
_local2.heapValue = _local7;
_local2.nv = _local18;
_local2.d = _local9.d + _local11;
_local2.parent = _local9;
_local6.insert(_local2);
}
_local11++;
}
_local5 = _local9.getNumFreeLeft();
_local5 = ((_local9.getNumFreeLeft() >= 1) ? 1 : 0);
_local11 = 1;
while (_local11 <= _local5) {
var _local2 = tiles_[_local3][_local4 - _local11];
var _local18 = ((tiles_[_local3][_local4 + _local11] == _local9.parent) ? (_local9.nv) : (_local9.nv + 1));
var _local7 = (((_local18 * 10) + _local9.d) + _local11) + (_local2.md * 2);
if ((!_local2.closed) && ((_local2.heapValue == 0) || (_local2.heapValue > _local7))) {
_local2.heapValue = _local7;
_local2.nv = _local18;
_local2.d = _local9.d + _local11;
_local2.parent = _local9;
_local6.insert(_local2);
}
_local11++;
}
if (_local6.size() == 0) {
_local12 = true;
}
}
var _local16 = new com.midasplayer.game.mahjongmasquerade.LineConnector(this, lineLayer_);
_local16.setValid(false);
var _local18 = _local8.nv;
var _local13 = new Array();
var _local9 = _local8;
_local13.push(_local9);
while (_local9.parent != null) {
if (_local9.nv != _local9.parent.nv) {
_local13.push(_local9.parent);
}
_local9 = _local9.parent;
}
var _local11 = _local18;
while (_local11 >= 0) {
_local16.addTile(_local13[_local11]);
_local11--;
}
_local16.draw();
trace("findNonValidPath - end. #loops: " + _local17);
}
function removeTile(tile) {
var _local6 = tile.getCol();
var _local7 = tile.getRow();
var _local2;
var _local3;
var _local4;
_local4 = tile.getNumFreeUp() + 1;
_local3 = _local6;
_local2 = _local7 + 1;
while (_local2 < rows_) {
var _local5 = tiles_[_local2][_local3];
_local5.addFreeUp(_local4);
if (_local5.getType() > 0) {
break;
}
_local2++;
}
_local4 = tile.getNumFreeRight() + 1;
_local2 = _local7;
_local3 = _local6 - 1;
while (_local3 >= 0) {
var _local5 = tiles_[_local2][_local3];
_local5.addFreeRight(_local4);
if (_local5.getType() > 0) {
break;
}
_local3--;
}
_local4 = tile.getNumFreeDown() + 1;
_local3 = _local6;
_local2 = _local7 - 1;
while (_local2 >= 0) {
var _local5 = tiles_[_local2][_local3];
_local5.addFreeDown(_local4);
if (_local5.getType() > 0) {
break;
}
_local2--;
}
_local4 = tile.getNumFreeLeft() + 1;
_local2 = _local7;
_local3 = _local6 + 1;
while (_local3 < cols_) {
var _local5 = tiles_[_local2][_local3];
_local5.addFreeLeft(_local4);
if (_local5.getType() > 0) {
break;
}
_local3++;
}
tile.remove();
}
function tick(tick) {
if (stopped_) {
return(undefined);
}
if (com.midasplayer.game.mahjongmasquerade.Game.isRelaxMode()) {
} else {
var _local2 = tick / TPS;
com.midasplayer.game.mahjongmasquerade.Game.setTime(_local2);
if ((!handleClick_) && (_local2 > com.midasplayer.game.mahjongmasquerade.Game.getMaxTime())) {
gameOver();
return(undefined);
}
}
lastTick_ = tick;
}
function render(tick, alpha) {
}
static var TPS = 25;
var clickedTile_ = null;
var noMoreMoves_ = false;
var obstacles_ = [[[2, 0], [2, 1], [2, 2], [2, 3]], [[1, 0], [2, 0], [3, 0], [2, 1]], [[1, 0], [2, 0], [2, 1], [3, 1]], [[1, 0], [2, 0], [2, 1], [2, 2]], [[1, 1], [2, 1], [1, 2], [2, 2]]];
}
Symbol 160 MovieClip [__Packages.com.midasplayer.timing.Timer] Frame 0
class com.midasplayer.timing.Timer
{
var gameTicksPerSecond, timeable;
function Timer (timeable, gameTicksPerSecond) {
this.gameTicksPerSecond = gameTicksPerSecond;
millisPerGameTick = 1000 / gameTicksPerSecond;
this.timeable = timeable;
}
function setTps(gameTicksPerSecond) {
this.gameTicksPerSecond = gameTicksPerSecond;
millisPerGameTick = 1000 / gameTicksPerSecond;
}
function advanceTime() {
time = getTimer();
var _local3 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local3;
var _local2 = 0;
while (unprocessedTime > millisPerGameTick) {
unprocessedTime = unprocessedTime - millisPerGameTick;
timeable.tick(tick);
tick++;
if ((tick % gameTicksPerSecond) == 0) {
fps = frames;
frames = 0;
}
_local2++;
if (_local2 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
frames++;
}
var time = 0;
var lastTime = 0;
var unprocessedTime = 0;
var tick = 0;
var millisPerGameTick = 0;
var fps = 0;
var frames = 0;
}
Symbol 161 MovieClip [__Packages.com.midasplayer.game.mahjongmasquerade.Tile] Frame 0
class com.midasplayer.game.mahjongmasquerade.Tile
{
var row_, col_;
function Tile (board, layer, type, row, col) {
board_ = board;
row_ = row;
col_ = col;
var _local2 = layer.getNextHighestDepth();
clip_ = layer.attachMovie("tile", "tile" + _local2, _local2);
type_ = type;
addFreeUp(0);
addFreeRight(0);
addFreeDown(0);
addFreeLeft(0);
unmarkClicked();
onRollOut();
render();
}
function displayHv() {
}
function setClickable(t) {
if (type_ == WALL_TYPE) {
t = false;
}
if (t) {
clip_.me = this;
clip_.onPress = function () {
this.me.onPress();
};
clip_.onRollOver = function () {
this.me.onRollOver();
};
clip_.onDragOver = function () {
this.me.onRollOver();
};
clip_.onRollOut = function () {
this.me.onRollOut();
};
clip_.onDragOut = function () {
this.me.onRollOut();
};
} else {
clip_.useHandCursor = false;
clip_.onPress = undefined;
clip_.onRollOver = undefined;
clip_.onDragOver = undefined;
clip_.onRollOut = undefined;
clip_.onDragOut = undefined;
}
}
function onPress() {
board_.tileClicked(this);
}
function onRollOver() {
clip_.over._visible = true;
}
function onRollOut() {
clip_.over._visible = false;
}
function setX(x) {
clip_._x = x;
}
function setY(y) {
clip_._y = y;
}
function getXMiddle() {
return(clip_._x + (WIDTH / 2));
}
function getYMiddle() {
return(clip_._y + (HEIGHT / 2));
}
function addFreeUp(num) {
numFreeUp_ = numFreeUp_ + num;
}
function addFreeRight(num) {
numFreeRight_ = numFreeRight_ + num;
}
function addFreeDown(num) {
numFreeDown_ = numFreeDown_ + num;
}
function addFreeLeft(num) {
numFreeLeft_ = numFreeLeft_ + num;
}
function getNumFreeUp() {
return(numFreeUp_);
}
function getNumFreeRight() {
return(numFreeRight_);
}
function getNumFreeDown() {
return(numFreeDown_);
}
function getNumFreeLeft() {
return(numFreeLeft_);
}
function isFreeExclusive(dx, dy) {
if (dx < 0) {
return(getNumFreeLeft() >= ((-dx) - 1));
}
if (dx > 0) {
return(getNumFreeRight() >= (dx - 1));
}
if (dy < 0) {
return(getNumFreeUp() >= ((-dy) - 1));
}
return(getNumFreeDown() >= (dy - 1));
}
function isFree(dx, dy) {
if (dx < 0) {
return(getNumFreeLeft() >= (-dx));
}
if (dx > 0) {
return(getNumFreeRight() >= dx);
}
if (dy < 0) {
return(getNumFreeUp() >= (-dy));
}
return(getNumFreeDown() >= dy);
}
function getType() {
return(type_);
}
function getRow() {
return(row_);
}
function getCol() {
return(col_);
}
function markClicked() {
clip_.mark._visible = true;
clip_.mark.gotoAndPlay(1);
}
function unmarkClicked() {
clip_.mark._visible = false;
clip_.mark.gotoAndStop(1);
}
function isRemoved() {
return(type_ == 0);
}
function remove() {
type_ = 0;
unmarkClicked();
onRollOut();
setClickable(false);
render();
}
function render() {
clip_.gotoAndStop(type_ + 1);
}
static var NUM_TILES = 27;
static var WALL_TYPE = 30;
static var WIDTH = 55;
static var HEIGHT = 55;
var type_ = 0;
var numFreeUp_ = 0;
var numFreeRight_ = 0;
var numFreeDown_ = 0;
var numFreeLeft_ = 0;
var clip_ = null;
var board_ = null;
var nv = 0;
var d = 0;
var md = 0;
var closed = false;
var heapValue = 0;
var parent = undefined;
}
Symbol 162 MovieClip [__Packages.com.midasplayer.util.StringTokenizer] Frame 0
class com.midasplayer.util.StringTokenizer
{
var str_, index_, len_, delim_, eof_;
function StringTokenizer (str, delim) {
str_ = str;
index_ = 0;
len_ = str_.length;
delim_ = " ";
eof_ = len_ == 0;
if (delim != undefined) {
delim_ = delim;
}
}
function hasMoreTokens() {
if (!eof_) {
return(true);
}
var _local2 = str_.indexOf(delim_, index_);
return(_local2 != -1);
}
function nextToken() {
var _local2 = str_.indexOf(delim_, index_);
if (_local2 == -1) {
_local2 = len_;
eof_ = true;
}
var _local3 = str_.substring(index_, _local2);
index_ = _local2 + 1;
return(_local3);
}
}
Symbol 163 MovieClip [__Packages.com.midasplayer.util.AnimPlayer] Frame 0
class com.midasplayer.util.AnimPlayer
{
static var clip_;
function AnimPlayer () {
}
static function staticInitializer(Void) {
clip_ = _root.createEmptyMovieClip("timer", _root.getNextHighestDepth());
clip_.onEnterFrame = function () {
com.midasplayer.util.AnimPlayer.onEnterFrame();
};
return(true);
}
static function play(props) {
animId_++;
var _local3 = props.playlist;
var _local4 = props.callback;
var _local5 = props.callback_scope;
var _local1 = props.tps;
if (_local1 == undefined) {
_local1 = 100;
}
callbacks_.put(animId_, _local4);
callbackScopes_.put(animId_, _local5);
animEntries_.put(animId_, new com.midasplayer.util.AnimEntry(_local3, animId_));
timers_.put(animId_, new com.midasplayer.timing.Timer(com.midasplayer.util.AnimEntry(animEntries_.get(animId_)), _local1));
return(animId_);
}
static function end(animId) {
delete eval (timers_.get(animId));
timers_.remove(animId);
delete eval (animEntries_.get(animId));
animEntries_.remove(animId);
var _local2 = callbacks_.get(animId);
callbacks_.remove(animId);
var _local3 = callbackScopes_.get(animId);
callbackScopes_.remove(animId);
_local2.call(_local3);
}
static function stop(animId) {
delete eval (timers_.get(animId));
timers_.remove(animId);
delete eval (animEntries_.get(animId));
animEntries_.remove(animId);
var _local2 = callbacks_.get(animId);
callbacks_.remove(animId);
var _local3 = callbackScopes_.get(animId);
callbackScopes_.remove(animId);
}
static function setTps(animId, tps) {
timers_.get(animId).setTps(tps);
}
static function tickToPercent(tick, startTick, numTicks) {
var _local1 = (tick - startTick) / numTicks;
_local1 = ((_local1 < 0) ? 0 : (_local1));
_local1 = ((_local1 > 1) ? 1 : (_local1));
return(_local1);
}
static function delay(props) {
play({playlist:[{obj:com.midasplayer.util.AnimPlayer, func:delayAnim, params:{millis:props.millis}}], callback:props.callback, callback_scope:props.callback_scope, tps:50});
}
static function delayAnim(tick, alpha, params) {
if ((tick / 50) >= (params.millis / 1000)) {
return(true);
}
return(false);
}
static function onEnterFrame() {
timers_.foreach(function (key, obj) {
com.midasplayer.timing.Timer(obj).advanceTime();
});
}
static var animId_ = 0;
static var animEntries_ = new com.midasplayer.util.Map();
static var timers_ = new com.midasplayer.util.Map();
static var callbacks_ = new com.midasplayer.util.Map();
static var callbackScopes_ = new com.midasplayer.util.Map();
static var staticInitialized = staticInitializer();
}
Symbol 164 MovieClip [__Packages.com.midasplayer.util.AnimEntry] Frame 0
class com.midasplayer.util.AnimEntry implements com.midasplayer.timing.Timeable
{
var playList_, animId_;
function AnimEntry (playList, animId) {
playList_ = playList;
animId_ = animId;
}
function tick(tick) {
}
function render(tick, alpha) {
if (baseTick_ == -1) {
baseTick_ = tick;
}
var _local2 = play(playList_, tick - baseTick_, alpha);
if (_local2) {
com.midasplayer.util.AnimPlayer.end(animId_);
}
}
function play(playList, tick, alpha) {
var _local12 = playList.length;
var _local4 = true;
var _local3 = 0;
while (_local3 < _local12) {
var _local2 = playList[_local3];
if (_local2 == undefined) {
} else if (_local2.length == undefined) {
var _local9 = _local2.func;
var _local8 = _local2.obj;
var _local10 = _local2.params;
var _local6 = _local9.call(_local8, tick, alpha, _local10);
if (_local6) {
playList[_local3] = undefined;
} else {
_local4 = false;
}
} else {
var _local6 = play(_local2, tick, alpha);
if (_local6) {
playList[_local3] = undefined;
baseTick_ = baseTick_ + tick;
_local4 = false;
break;
}
_local4 = false;
break;
}
_local3++;
}
return(_local4);
}
var baseTick_ = -1;
}
Symbol 165 MovieClip [__Packages.com.midasplayer.fx.SoundManager] Frame 0
class com.midasplayer.fx.SoundManager
{
function SoundManager () {
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
static function stopAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.stop();
soundEntry.playStatus = false;
});
}
static function muteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(0);
});
}
static function restoreMuteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(soundEntry.realVol);
});
}
static function stop(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.stop();
_local1.playStatus = false;
}
}
static function getCalibratedVolume(flashVolume) {
flashVolume = Math.min(100, flashVolume);
flashVolume = Math.max(0, flashVolume);
return(Math.ceil(Math.pow(flashVolume / 100, 1.46) * 100));
}
static function setVolume(resource, percent) {
var _local1 = sounds.get(resource);
if (_local1 == undefined) {
var _local3 = new Array();
_local3.push(resource);
initialize(_local3);
}
_local1 = sounds.get(resource);
if (_local1 != undefined) {
var _local2 = percent;
_local1.sound.setVolume(_local2);
_local1.sound.volume = _local2;
}
}
static function getVolume(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
return(_local1.sound.getVolume());
}
return(100);
}
static function isPlaying(resource) {
var _local1 = sounds.get(resource);
return((_local1 != undefined) && (_local1.playStatus == true));
}
static function initialize(list) {
for (var _local9 in list) {
var resource = list[_local9];
var _local3 = _root.getNextHighestDepth();
var _local2 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local3, _local3));
_local2.attachSound(resource);
_local2.onSoundComplete = function () {
var _local1 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local1.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local2, playStatus:false});
}
}
static function play(resource, volume, isLoop, fn) {
if (volume == undefined) {
volume = getVolume(resource);
}
if (isLoop == undefined) {
isLoop = false;
}
var _local2 = sounds.get(resource);
if (_local2 != undefined) {
_local2.sound.setVolume((soundEnabled ? (volume) : 0));
_local2.realVol = volume;
_local2.playStatus = true;
_local2.onPlayedFn = fn;
_local2.sound.start(0, (isLoop ? 32767 : 1));
} else {
var _local6 = _root.getNextHighestDepth();
var _local3 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local6, _local6));
_local3.attachSound(resource);
_local3.onSoundComplete = function () {
var _local1 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local1.playStatus = false;
com.midasplayer.fx.SoundManager.onPlayed_(resource);
};
_local3.setVolume((soundEnabled ? (volume) : 0));
_local3.start(0, (isLoop ? 32767 : 1));
sounds.put(resource, {realVol:volume, onPlayedFn:fn, sound:_local3, playStatus:true});
}
}
static function onPlayed_(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.onPlayedFn != undefined)) {
_local1.onPlayedFn();
}
}
static var sounds = new com.midasplayer.util.Map();
static var soundEnabled = true;
}
Symbol 166 MovieClip [__Packages.com.midasplayer.game.mahjongmasquerade.LineConnector] Frame 0
class com.midasplayer.game.mahjongmasquerade.LineConnector
{
var board_, clip_, showPossibleMove_, dotsLayer_, tiles_, valid_, lineColor_, lineSpeed_, dotSpeed_;
function LineConnector (board, layer, showPossibleMove) {
board_ = board;
clip_ = layer.createEmptyMovieClip("line", 1);
showPossibleMove_ = showPossibleMove;
dotsLayer_ = layer.createEmptyMovieClip("dots", 2);
tiles_ = new Array();
setValid(true);
}
function setValid(b) {
valid_ = b;
if (showPossibleMove_) {
lineColor_ = 16777215 /* 0xFFFFFF */;
lineSpeed_ = 2;
dotSpeed_ = 2;
return(undefined);
}
if (valid_) {
lineColor_ = 12824371 /* 0xC3AF33 */;
lineSpeed_ = 7;
dotSpeed_ = 5;
} else {
lineColor_ = 15938355 /* 0xF33333 */;
lineSpeed_ = 20;
dotSpeed_ = 10;
}
}
function addTile(tile) {
tiles_[numTiles_] = tile;
numTiles_++;
}
function draw() {
var _local3 = [];
var _local4 = numTiles_ - 1;
var _local2 = 0;
while (_local2 < _local4) {
_local3.push([{obj:this, func:drawLineAnim, params:{line:_local2}}]);
if (_local2 < (_local4 - 1)) {
_local3.push([{obj:this, func:drawDotAnim, params:{point:_local2}}]);
}
_local2++;
}
if (valid_) {
_local3.push([{obj:this, func:soundPair}]);
} else {
_local3.push([{obj:this, func:soundNoPair}]);
}
_local3.push([{obj:this, func:drawDotAnim, params:{point:numTiles_ - 2}}]);
com.midasplayer.util.AnimPlayer.play({playlist:_local3, callback:endDraw, callback_scope:this, tps:50});
}
function soundPair(tick, alpha) {
if (board_.isStopped()) {
return(undefined);
}
com.midasplayer.fx.SoundManager.play("snd_pair", 100);
return(true);
}
function soundNoPair(tick, alpha) {
if (board_.isStopped()) {
return(undefined);
}
com.midasplayer.fx.SoundManager.play("snd_no_pair", 100);
return(true);
}
function drawLineAnim(tick, alpha, params) {
var _local7 = params.line;
var _local9 = tiles_[_local7];
var _local8 = tiles_[_local7 + 1];
var _local5 = _local9.getXMiddle();
var _local3 = _local9.getYMiddle();
var _local4 = _local8.getXMiddle();
var _local2 = _local8.getYMiddle();
var _local11 = _local4 - _local5;
var _local10 = _local2 - _local3;
var _local6 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, lineSpeed_);
_local4 = _local5 + (_local11 * _local6);
_local2 = _local3 + (_local10 * _local6);
clip_.lineStyle(4, lineColor_);
clip_.moveTo(_local5, _local3);
clip_.lineTo(_local4, _local2);
return(_local6 == 1);
}
function drawDotAnim(tick, alpha, params) {
var _local8 = params.point;
var _local7 = tiles_[_local8 + 1];
var _local4 = _local7.getXMiddle();
var _local3 = _local7.getYMiddle();
var _local6 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, dotSpeed_);
var _local2 = _local6 * 7;
var _local5 = dotsLayer_;
_local5.lineStyle(0, lineColor_);
_local5.beginFill(lineColor_);
_local5.moveTo(_local4, _local3 + _local2);
_local5.curveTo(_local4 + _local2, _local3 + _local2, _local4 + _local2, _local3);
_local5.curveTo(_local4 + _local2, _local3 - _local2, _local4, _local3 - _local2);
_local5.curveTo(_local4 - _local2, _local3 - _local2, _local4 - _local2, _local3);
_local5.curveTo(_local4 - _local2, _local3 + _local2, _local4, _local3 + _local2);
_local5.endFill();
return(_local6 == 1);
}
function endDraw() {
clip_.clear();
dotsLayer_.clear();
if (board_.isStopped()) {
return(undefined);
}
board_.endFindPath(valid_, tiles_[0], tiles_[numTiles_ - 1]);
}
var numTiles_ = 0;
}
Symbol 167 MovieClip [__Packages.com.midasplayer.util.BinaryHeap] Frame 0
class com.midasplayer.util.BinaryHeap
{
var array_;
function BinaryHeap () {
array_ = new Array();
}
function heapify(i) {
var _local8 = false;
var _local7 = array_.length;
while (!_local8) {
var _local5 = (i << 1) + 1;
var _local4 = (i << 1) + 2;
var _local2 = i;
if ((_local5 < _local7) && (array_[_local5].heapValue < array_[_local4].heapValue)) {
_local2 = _local5;
}
if ((_local4 < _local7) && (array_[_local4].heapValue < array_[_local2].heapValue)) {
_local2 = _local4;
}
if (_local2 != i) {
var _local6 = array_[i];
array_[i] = array_[_local2];
array_[_local2] = _local6;
i = _local2;
} else {
_local8 = true;
}
}
}
function size() {
return(array_.length);
}
function removeMin() {
var _local2 = array_.shift();
heapify(0);
return(_local2);
}
function insert(obj) {
var _local2 = array_.length;
array_.length++;
while ((_local2 > 0) && (array_[(_local2 - 1) >> 1].heapValue > obj.heapValue)) {
array_[_local2] = array_[(_local2 - 1) >> 1];
_local2 = (_local2 - 1) >> 1;
}
array_[_local2] = obj;
}
}
Symbol 168 MovieClip [__Packages.com.midasplayer.game.mahjongmasquerade.Clock] Frame 0
class com.midasplayer.game.mahjongmasquerade.Clock
{
var parentClip_, clip_, maxTime_;
function Clock (parentClip) {
parentClip_ = parentClip;
clip_ = parentClip_.attachMovie("timeline", "clock", parentClip_.getNextHighestDepth());
clip_._x = 137.5;
clip_._y = 40;
reset();
}
function setVisible(b) {
clip_._visible = b;
}
function setMaxTime(t) {
maxTime_ = t;
hasWarned_ = false;
}
function reset() {
setTime(0);
}
function showPenalty() {
}
function setTime(t) {
time_ = t;
displayTime();
}
function displayTime() {
var _local2 = 1 + Math.round((clip_._totalframes * time_) / maxTime_);
_local2 = Math.min(_local2, clip_._totalframes);
if (maxTime_ == undefined) {
clip_.gotoAndStop(1);
return(undefined);
}
clip_.gotoAndStop(_local2);
if ((!hasWarned_) && ((maxTime_ - time_) < 10)) {
hasWarned_ = true;
com.midasplayer.fx.SoundManager.play("snd_time", 100);
}
}
var time_ = 0;
var hasWarned_ = false;
}