Frame 1
var _oPreloaderScreen = (new com.disney.gem.games.mickeyFriendsTownRace.screens.PreloaderScreen(mcScreens.mcPreloader));
com.sarbakan.BaseDisneyController.bDEBUG = false;
new com.disney.gem.games.mickeyFriendsTownRace.Controller(this, _oPreloaderScreen);
Symbol 4 MovieClip [mcRouteNode] Frame 1
stop();
Symbol 920 MovieClip [__Packages.com.sarbakan.BaseDisneyController] Frame 0
class com.sarbakan.BaseDisneyController
{
static var oInstance;
var mcTimeline, oPreloaderScreen, oMainBroadcaster, oFrameRate, aPopups, oTransitionManager, bSoundMuted, nLastSoundToggleTimer, bPaused, oDXDControllerWrapper, nGamePhase, oCurrentScreen, fScreenShowTransitionCallBack, fScreenHideCallBack, nLevel, nScore, bInstructionCanBeDisplayed, bInstructionActive, nLastUpdateTimer;
function BaseDisneyController (_mcTimeline, _oPreloaderScreen) {
oInstance = this;
mcTimeline = _mcTimeline;
_mcTimeline.stop();
oPreloaderScreen = _oPreloaderScreen;
oMainBroadcaster = new Object();
AsBroadcaster.initialize(oMainBroadcaster);
oMainBroadcaster.addListener(this);
if (bDEBUG) {
oFrameRate = new com.sarbakan.utils.FrameRateDisplayer(_mcTimeline, nFRAME_RATE, nGAME_STAGE_WIDTH);
oMainBroadcaster.addListener(oFrameRate);
} else {
Stage.showMenu = false;
mcTimeline._focusrect = false;
}
aPopups = new Array();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
setDXDCallback();
} else {
initStandAloneController();
}
}
static function getInstance() {
return(oInstance);
}
function init() {
setGamePhase(nGAME_PHASE_PACKAGING);
stopScreenContainers();
oTransitionManager = new com.sarbakan.utils.TransitionManager(mcTimeline.mcTransitions);
oMainBroadcaster.addListener(oTransitionManager);
bSoundMuted = false;
nLastSoundToggleTimer = getTimer();
}
function update(_nElapsed) {
if (bPaused) {
oMainBroadcaster.broadcastMessage("onUpdatePaused", _nElapsed);
} else {
oMainBroadcaster.broadcastMessage("onUpdate", _nElapsed);
}
checkGlobalKeys();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
bSoundMuted = oDXDControllerWrapper.isMuted();
}
}
function pause() {
if (!bPaused) {
bPaused = true;
oMainBroadcaster.broadcastMessage("onPause");
}
}
function unpause() {
if (bPaused) {
bPaused = false;
oMainBroadcaster.broadcastMessage("onUnPause");
}
}
function togglePause() {
if (bPaused) {
unpause();
} else {
pause();
}
}
function getControllerMode() {
if (com.disney.gem.base.BaseObject == undefined) {
var _local2 = nCONTROLLER_MODE_STANDALONE;
} else {
var _local2 = nCONTROLLER_MODE_DXD;
}
return(_local2);
}
function setGamePhase(_nPhase) {
nGamePhase = _nPhase;
switch (_nPhase) {
case nGAME_PHASE_PRELOADER :
mcTimeline.gotoAndStop("preloader");
break;
case nGAME_PHASE_PACKAGING :
mcTimeline.gotoAndStop("packaging");
break;
case nGAME_PHASE_INGAME :
mcTimeline.gotoAndStop("game");
}
}
function getGamePhase() {
return(nGamePhase);
}
function gameLog(_sText) {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.gameLog(_sText);
}
}
function showScreen(_oScreenController, _bInOut, _sTransitionID, _fMidTransitionCallBack) {
if (oCurrentScreen) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, showScreen, _oScreenController, _bInOut, null, _fMidTransitionCallBack), _sTransitionID);
} else {
oCurrentScreen = _oScreenController;
oCurrentScreen.setGameController(this);
if (_sTransitionID != undefined) {
fScreenShowTransitionCallBack = _fMidTransitionCallBack;
oTransitionManager.playTransition(_sTransitionID, com.sarbakan.utils.Delegate.create(this, onScreenShowTransitionMiddle, _bInOut));
} else {
oCurrentScreen.show(_bInOut);
_fMidTransitionCallBack();
}
oMainBroadcaster.addListener(oCurrentScreen);
}
}
function hideCurrentScreen(_fHideCallBack, _sTransition, _fEndCallBack) {
fScreenHideCallBack = _fHideCallBack;
if (_sTransition != undefined) {
oTransitionManager.playTransition(_sTransition, com.sarbakan.utils.Delegate.create(oCurrentScreen, oCurrentScreen.hide, com.sarbakan.utils.Delegate.create(this, onScreenHidden)), _fEndCallBack);
} else {
oCurrentScreen.hide(com.sarbakan.utils.Delegate.create(this, onScreenHidden));
}
}
function showPopup(_oPopupController, _bInOut) {
var _local4 = false;
var _local5 = aPopups.length - 1;
for ( ; _local5 >= 0 ; _local5--) {
var _local6 = aPopups[_local5];
if (_oPopupController.getRef() == _local6.getRef()) {
_local4 = true;
_local6.destroy();
oMainBroadcaster.removeListener(_local6);
aPopups[_local5] = _oPopupController;
break;
}
}
if (!_local4) {
aPopups.push(_oPopupController);
}
_oPopupController.setGameController(this);
_oPopupController.show(_bInOut);
oMainBroadcaster.addListener(_oPopupController);
}
function setLevel(_nLevel) {
nLevel = _nLevel;
}
function getLevel() {
return(nLevel);
}
function setScore(_nScore) {
nScore = _nScore;
}
function increaseScore(_nIncrement) {
nScore = nScore + _nIncrement;
}
function getScore() {
return(nScore);
}
function allowInstructions() {
bInstructionCanBeDisplayed = true;
}
function disallowInstructions() {
bInstructionCanBeDisplayed = false;
}
function showInstructions() {
if (canShowInstructions()) {
bInstructionActive = true;
showInstructionsScreen();
}
}
function hideInstructions() {
if (canHideInstructions()) {
bInstructionActive = false;
hideInstructionsScreen();
}
}
function toggleSound() {
if ((getTimer() - nLastSoundToggleTimer) >= nSOUND_TOGGLE_DELAY) {
bSoundMuted = !bSoundMuted;
nLastSoundToggleTimer = getTimer();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.toggleSound();
} else {
toggleSoundStandalone();
}
}
}
function onPreloadingDone() {
hideCurrentScreen();
init();
}
function onGameStart() {
setLevel(1);
setScore(0);
}
function onLevelStart() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.startLevel(nLevel, nScore);
}
}
function onLevelEnd() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.endLevel(nLevel, nScore);
}
}
function onGameEnd() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.endGame(nLevel, nScore);
}
}
function onTransitionStart(_mcTransition) {
}
function onTransitionMiddle(_mcTransition) {
}
function onEnterFrame() {
var _local2 = getTimer();
update(_local2 - nLastUpdateTimer);
nLastUpdateTimer = _local2;
}
function onScreenShowTransitionMiddle(_bInOut) {
fScreenShowTransitionCallBack();
oCurrentScreen.show(_bInOut);
}
function onScreenHidden() {
oMainBroadcaster.removeListener(oCurrentScreen);
delete oCurrentScreen;
fScreenHideCallBack();
}
function setDXDCallback() {
mcTimeline.init = com.sarbakan.utils.Delegate.create(this, initDXDController);
}
function initDXDController(_oOwner) {
oDXDControllerWrapper = new com.sarbakan.DXDControllerWrapper(this, mcTimeline, _oOwner);
return(oDXDControllerWrapper);
}
function initStandAloneController() {
mcTimeline.onEnterFrame = com.sarbakan.utils.Delegate.create(this, onEnterFrame);
nLastUpdateTimer = getTimer();
initPreloader();
}
function initPreloader() {
setGamePhase(nGAME_PHASE_PRELOADER);
showScreen(oPreloaderScreen);
}
function checkGlobalKeys() {
if (Key.isDown(nKEY_INSTRUCTIONS)) {
if (!bInstructionActive) {
showInstructions();
} else {
hideInstructions();
}
}
if (Key.isDown(nKEY_SOUND)) {
toggleSound();
}
}
function toggleSoundStandalone() {
var _local2 = new Sound(mcTimeline);
if (!bSoundMuted) {
_local2.setVolume(100);
} else {
_local2.setVolume(0);
}
}
function canShowInstructions() {
return((!bInstructionActive) && (bInstructionCanBeDisplayed && ((!oCurrentScreen.isInOutTransitionning()) && (!oTransitionManager.isTransitionning()))));
}
function canHideInstructions() {
return(bInstructionActive && (bInstructionCanBeDisplayed && ((!oCurrentScreen.isInOutTransitionning()) && (!oTransitionManager.isTransitionning()))));
}
function showInstructionsScreen() {
}
function hideInstructionsScreen() {
}
function stopScreenContainers() {
var _local2 = [mcTimeline.mcPopups, mcTimeline.mcScreens];
var _local3 = _local2.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
for (var j in _local2[_local3]) {
_local2[_local3][j].stop();
}
}
}
static var bDEBUG = true;
static var nFRAME_RATE = 30;
static var nCONTROLLER_MODE_STANDALONE = 1;
static var nCONTROLLER_MODE_DXD = 2;
static var nGAME_PHASE_PRELOADER = 1;
static var nGAME_PHASE_PACKAGING = 2;
static var nGAME_PHASE_INGAME = 3;
static var nKEY_INSTRUCTIONS = 72;
static var nKEY_SOUND = 77;
static var nGAME_STAGE_WIDTH = 580;
static var nGAME_STAGE_HEIGHT = 400;
static var nSOUND_TOGGLE_DELAY = 100;
}
Symbol 921 MovieClip [__Packages.com.sarbakan.utils.StateManaged] Frame 0
class com.sarbakan.utils.StateManaged
{
var mcRef, bPausable, sNextState, sState;
function StateManaged (_mcRef) {
setMC(_mcRef);
setPausable(true);
}
function setMC(_mcRef) {
mcRef = _mcRef;
}
function setPausable(_bPausable) {
bPausable = _bPausable;
}
function setState(_sState, _bInstant, _bForce) {
sNextState = _sState;
if (_bInstant) {
checkStateChange();
}
if (_bForce) {
mcRef.mcState.gotoAndPlay(1);
}
}
function getState() {
return(sState);
}
function stateStarting() {
return(mcRef.mcState._currentframe == 1);
}
function stateFinished() {
return(mcRef.mcState._currentframe == mcRef.mcState._totalframes);
}
function stateCurrentFrame() {
return(mcRef.mcState._currentframe);
}
function stateIsNot() {
var _local2 = false;
var _local3 = arguments.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
if (arguments[_local3] == sState) {
_local2 = true;
break;
}
}
return(!_local2);
}
function destroy() {
delete mcRef;
}
function get Mc() {
return(mcRef);
}
function onUpdate() {
checkStateChange();
this["state_" + sState]();
}
function checkStateChange() {
if ((sNextState != undefined) && (sNextState != sState)) {
this[("state_" + sState) + "_end"]();
sState = sNextState;
sNextState = undefined;
mcRef.gotoAndStop(sState);
this[("state_" + sState) + "_init"]();
}
}
function onUpdatePaused() {
if (bPausable == false) {
onUpdate();
}
}
function onPause() {
if (bPausable) {
mcRef.mcState.stop();
}
}
function onUnPause() {
if (bPausable) {
mcRef.mcState.play();
}
}
}
Symbol 922 MovieClip [__Packages.com.sarbakan.utils.TransitionManager] Frame 0
class com.sarbakan.utils.TransitionManager extends com.sarbakan.utils.StateManaged
{
var setPausable, mcTransitionContainer, mcTransition, fMiddleCallBack, fEndCallBack, bTransitionning, setMC, setState, stateFinished, mcRef;
function TransitionManager (_mcTransition) {
super();
setPausable(false);
mcTransitionContainer = _mcTransition;
for (var i in mcTransitionContainer) {
mcTransitionContainer[i].stop();
}
}
function playTransition(_sTransitionID, _fMiddleCallBack, _fEndCallBack) {
mcTransition = mcTransitionContainer["mc" + com.sarbakan.utils.MoreString.upperFirstChar(_sTransitionID)];
fMiddleCallBack = _fMiddleCallBack;
fEndCallBack = _fEndCallBack;
if (mcTransition == undefined) {
} else {
bTransitionning = true;
setMC(mcTransition);
setState(sSTATE_IN);
}
}
function isTransitionning() {
return(bTransitionning);
}
function state_in() {
if (stateFinished()) {
setState(sSTATE_OUT);
fMiddleCallBack();
}
}
function state_out() {
if (stateFinished()) {
bTransitionning = false;
setState(sSTATE_HIDDEN);
fEndCallBack();
}
}
function state_in_init() {
com.sarbakan.BaseDisneyController.getInstance().onTransitionStart(mcTransition);
mcRef.btBlocker.useHandCursor = false;
}
function state_out_init() {
com.sarbakan.BaseDisneyController.getInstance().onTransitionMiddle(mcTransition);
mcRef.btBlocker.useHandCursor = false;
}
static var sSTATE_IN = "in";
static var sSTATE_OUT = "out";
static var sSTATE_HIDDEN = "hidden";
}
Symbol 923 MovieClip [__Packages.com.sarbakan.utils.MoreString] Frame 0
class com.sarbakan.utils.MoreString
{
function MoreString () {
}
static function pad(_sToPad, _sCharPad, _nMinLength, _sSideToPad) {
var _local6 = String(_sToPad);
while (_local6.length < _nMinLength) {
if (_sSideToPad == "RIGHT") {
_local6 = _local6 + _sCharPad;
} else {
_local6 = _sCharPad + _local6;
}
}
return(_local6);
}
static function trim(_sToTrim, _sCharTrim, _sSideToTrim) {
var _local5 = String(_sToTrim);
if (_sSideToTrim == "RIGHT") {
while (_local5.substr(_local5.length - 2, 1) == _sCharTrim) {
_local5 = _local5.slice(-1);
}
} else {
while (_local5.substr(0, 1) == _sCharTrim) {
_local5 = _local5.slice(1);
}
}
return(_local5);
}
static function replace(_sString, _sFind, _sReplace) {
return(_sString.split(_sFind).join(_sReplace));
}
static function formatTime(_nTime) {
var _local3 = _nTime;
var _local4 = Math.floor(_local3 / 60);
var _local5 = Math.round(_local3 - (_local4 * 60));
return((pad(String(_local4), "0", 2) + ":") + pad(String(_local5), "0", 2));
}
static function formatNumber(__sNumber, __nMinimumChar) {
var _local4 = String(__sNumber);
var _local5 = "";
var _local6 = _local4.length;
_local6 = _local6 / 3;
if (_local6 <= 1) {
var _local7 = _local4;
if (_local7.length < __nMinimumChar) {
_local7 = "0" + _local7;
}
} else {
var _local8 = _local6;
for ( ; _local8 > 1 ; _local8--) {
_local5 = (" " + _local4.substr(-3)) + _local5;
_local4 = _local4.substr(0, -3);
}
var _local7 = _local4 + _local5;
if (_local7.length < __nMinimumChar) {
_local7 = "0" + _local7;
}
}
return(_local7);
}
static function upperFirstChar(_sString) {
return(_sString.substr(0, 1).toUpperCase() + _sString.substr(1));
}
static function lowerFirstChar(_sString) {
return(_sString.substr(0, 1).toLowerCase() + _sString.substr(1));
}
static function convertToBoolean(_sString) {
return(_sString.toLowerCase() == "true");
}
static function formatMoney(_nMoney, _sDelimiteur, _bDecimalOpt) {
if (_bDecimalOpt == undefined) {
var _local9 = true;
} else {
var _local9 = _bDecimalOpt;
}
var _local5 = String(_nMoney).split(".");
if (_local5[1] != undefined) {
var _local6 = _local5[1].substr(0, 2);
switch (_local6.length) {
case 0 :
_local6 = _local6 + "00";
break;
case 1 :
_local6 = _local6 + "0";
break;
case 2 :
break;
default :
_local6 = "00";
}
} else {
var _local6 = "00";
}
var _local8 = _local5[0];
var _local7 = "";
while (_local8.length > 3) {
_local7 = (_sDelimiteur + _local8.substr(_local8.length - 3)) + _local7;
_local8 = _local8.substr(0, _local8.length - 3);
}
_local7 = _local8 + _local7;
if (_local9) {
return(((_local7 + ".") + _local6) + "$");
}
return(_local7 + " $");
}
static function getOrdinalSuffix(_nNumber) {
var _local4 = String(_nNumber);
if ((_local4.substr(-2, 2) == 11) || ((_local4.substr(-2, 2) == 12) || (_local4.substr(-2, 2) == 13))) {
var _local3 = "th";
} else if (_local4.substr(-1, 1) == 1) {
var _local3 = "st";
} else if (_local4.substr(-1, 1) == 2) {
var _local3 = "nd";
} else if (_local4.substr(-1, 1) == 3) {
var _local3 = "rd";
} else {
var _local3 = "th";
}
return(_local3);
}
}
Symbol 924 MovieClip [__Packages.com.sarbakan.DXDControllerWrapper] Frame 0
class com.sarbakan.DXDControllerWrapper extends com.disney.gem.games.BaseGameController
{
var oRealController, __owner;
function DXDControllerWrapper (_oRealController, _mcTimeline, _oOwner) {
super(_mcTimeline, _oOwner);
oRealController = _oRealController;
}
function init() {
super.init();
oRealController.init();
}
function update(_nElapsed) {
oRealController.update(_nElapsed);
}
function toggleSound() {
__owner.onToggleSound();
}
function isMuted() {
return(!__owner.__soundOn);
}
function gameLog(_sText) {
__owner.gameLog(_sText, "game");
}
}
Symbol 925 MovieClip [__Packages.com.disney.gem.games.GameContainer] Frame 0
class com.disney.gem.games.GameContainer
{
function GameContainer () {
}
}
Symbol 926 MovieClip [__Packages.com.sarbakan.utils.FrameRateDisplayer] Frame 0
class com.sarbakan.utils.FrameRateDisplayer
{
var nMovieFPS, nUpdateCounter, nAverageFps, nCurrentFPS, nUpdateCount, mcDebug, nLastGetTimer;
function FrameRateDisplayer (_mcTimeline, _nMovieFPS, _nStageWidth) {
nMovieFPS = _nMovieFPS;
nUpdateCounter = 0;
nAverageFps = 0;
nCurrentFPS = nMovieFPS;
reset();
startDebug(_mcTimeline, _nStageWidth);
}
function get fps() {
return(nCurrentFPS);
}
function onUpdate() {
if ((++nUpdateCount) == nMovieFPS) {
computeFrameRate();
updateDebug();
}
}
function onUpdatePaused() {
onUpdate();
}
function startDebug(_mcTimeline, _nStageWidth) {
mcDebug = _mcTimeline.createEmptyMovieClip("PerformanceWatcherDebug", DEBUG_DEPTH);
mcDebug._x = (_nStageWidth - DEBUG_RIGHT_MARGIN) - 400;
mcDebug._y = DEBUG_TOP_MARGIN;
mcDebug.createTextField("field", 2, 0, 0, 400, 50);
var _local4 = new TextFormat();
_local4.font = DEBUG_FONT;
_local4.size = DEBUG_FONT_SIZE;
_local4.color = DEBUG_FONT_COLOR;
_local4.align = "right";
mcDebug.field.setNewTextFormat(_local4);
mcDebug.field.selectable = false;
mcDebug.createTextField("fieldShadow", 1, 1, 1, 400, 50);
var _local5 = new TextFormat();
_local5.font = DEBUG_FONT;
_local5.size = DEBUG_FONT_SIZE;
_local5.color = DEBUG_FONT_SHADOW_COLOR;
_local5.align = "right";
mcDebug.fieldShadow.setNewTextFormat(_local5);
mcDebug.fieldShadow.selectable = false;
}
function reset() {
nUpdateCount = 0;
nLastGetTimer = getTimer();
}
function computeFrameRate() {
var _local2 = getTimer() - nLastGetTimer;
var _local3 = _local2 / 1000;
nCurrentFPS = Math.round(nMovieFPS / _local3);
reset();
}
function updateDebug() {
if (mcDebug != undefined) {
nUpdateCounter++;
var _local2 = ((nCurrentFPS + " fps (avg ") + getAverage()) + ")";
mcDebug.field.text = _local2;
mcDebug.fieldShadow.text = _local2;
}
}
function getAverage() {
nAverageFps = nAverageFps + ((nCurrentFPS - nAverageFps) * (1 / nUpdateCounter));
var _local2 = "";
var _local3 = String(nAverageFps).split(".");
if (_local3[1] == undefined) {
_local2 = nAverageFps + ".00";
} else if (_local3[1].length == 1) {
_local2 = (_local3[0] + ".0") + _local3[1];
} else {
_local2 = (_local3[0] + ".") + _local3[1].substr(0, 2);
}
return(_local2);
}
static var DEBUG_DEPTH = 123456;
static var DEBUG_RIGHT_MARGIN = 0;
static var DEBUG_TOP_MARGIN = 0;
static var DEBUG_FONT = "Verdana";
static var DEBUG_FONT_SIZE = 10;
static var DEBUG_FONT_COLOR = 16777215;
static var DEBUG_FONT_SHADOW_COLOR = 0;
}
Symbol 927 MovieClip [__Packages.com.sarbakan.utils.ScreenController] Frame 0
class com.sarbakan.utils.ScreenController extends com.sarbakan.utils.StateManaged
{
var setMC, setState, setPausable, oController, bInOut, fHideCallBack, mcRef, sState, stateFinished;
function ScreenController (_mcRef) {
super();
setMC(_mcRef);
setState(sSTATE_HIDDEN);
setPausable(false);
}
function setGameController(_oController) {
oController = _oController;
}
function show(_bInOut) {
bInOut = _bInOut;
if (bInOut) {
setState(sSTATE_IN, true);
} else {
setState(sSTATE_IDLE, true);
}
}
function hide(_fHideCallBack, _bInOutOverride) {
fHideCallBack = _fHideCallBack;
var _local4 = bInOut;
if (_bInOutOverride != undefined) {
_local4 = _bInOutOverride;
}
if (_local4) {
setState(sSTATE_OUT);
} else {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function getRef() {
return(mcRef);
}
function isInOutTransitionning() {
return((sState == sSTATE_IN) || (sState == sSTATE_OUT));
}
function state_in() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_out() {
if (stateFinished()) {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function state_in_init() {
mcRef.btBlocker.useHandCursor = false;
}
function state_idle_init() {
mcRef.btBlocker.useHandCursor = false;
}
function state_out_init() {
mcRef.btBlocker.useHandCursor = false;
}
static var sSTATE_HIDDEN = "hidden";
static var sSTATE_IN = "in";
static var sSTATE_IDLE = "idle";
static var sSTATE_OUT = "out";
}
Symbol 928 MovieClip [__Packages.com.sarbakan.utils.Delegate] Frame 0
class com.sarbakan.utils.Delegate extends Object
{
var func;
function Delegate () {
super();
}
function DelegateArgs(f) {
func = f;
}
static function create(obj, func) {
var _local4 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
var _local4 = arguments.callee.arg;
_local4 = _local4.concat(arguments);
return(_local3.apply(_local2, _local4));
};
_local4.target = obj;
_local4.func = func;
_local4.arg = arguments.slice(2);
return(_local4);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 929 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.Controller] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.Controller extends com.sarbakan.BaseDisneyController
{
var nPointsCupToon, nPointsCupMirror, nPointsCupLTS, mcTimeline, nGamePhase, showScreen, allowInstructions, pause, unpause, hideCurrentScreen, onGameStart, oGame, oMainBroadcaster, onGameEnd, oMusicGame, oMusicPack;
function Controller (_mcTimeline, _oPreloaderScreen) {
super(_mcTimeline, _oPreloaderScreen);
nPointsCupToon = 0;
nPointsCupMirror = 0;
nPointsCupLTS = 0;
}
function init() {
super.init();
var _local3 = mcTimeline.createEmptyMovieClip("mcSounds", nSOUND_MC_DEPTH);
com.sarbakan.sound.SoundManager.doInit(_local3);
com.sarbakan.sound.SoundManager.setCategoryVolume(sSOUND_CAT_MUSIC, nSOUND_VOL_MUSIC);
com.sarbakan.sound.SoundManager.setCategoryVolume(sSOUND_CAT_SFX, nSOUND_VOL_SFX);
showTitleScreen();
startMusicForPhase(nGamePhase);
}
function showTitleScreen(_bShowTransition) {
if (_bShowTransition) {
showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT);
} else {
showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.TitleScreen(mcTimeline.mcScreens.mcTitle));
}
allowInstructions();
}
function showInstructionsScreen() {
pause();
showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.HelpScreen(mcTimeline.mcScreens.mcHelp), false, sTRANSITION_DEFAULT);
}
function hideInstructionsScreen() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
unpause();
hideCurrentScreen(null, sTRANSITION_DEFAULT);
} else {
startGame();
}
}
function startGame() {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, onGameStarted), sTRANSITION_DEFAULT);
}
function setGamePhase(_nPhase, _bSwitchMusic) {
super.setGamePhase(_nPhase);
if (_nPhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING) {
clearGame();
}
if (_bSwitchMusic) {
startMusicForPhase(_nPhase);
}
}
function setRollSound(_btTarget) {
_btTarget.onRollOver = com.sarbakan.utils.Delegate.create(this, castRollSound);
}
function castRollSound() {
com.sarbakan.sound.SoundManager.isSoundPlaying("Button_Roll.wav").oSound.doStop();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SFX, "Button_Roll.wav");
}
function castClickSound() {
com.sarbakan.sound.SoundManager.isSoundPlaying("Button_Click.wav").oSound.doStop();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SFX, "Button_Click.wav");
}
function goBackToTitle() {
showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, setGamePhase, com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING));
}
function isLastDriverLocked() {
var _local2 = SharedObject.getLocal(sSO_NAME);
var _local3 = false;
if (_local2.data.bAvailable) {
_local3 = true;
}
return(!_local3);
}
static function getInstance() {
return(com.disney.gem.games.mickeyFriendsTownRace.Controller(com.sarbakan.BaseDisneyController.oInstance));
}
function onTransitionStart(_mcTransition) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SFX, "Transition.wav");
}
function onTransitionMiddle(_mcTransition) {
}
function onGameStarted() {
onGameStart();
unpause();
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME, false);
oGame = new com.disney.gem.games.mickeyFriendsTownRace.GameEngine(this, mcTimeline.mcGame);
oMainBroadcaster.addListener(oGame);
oGame.init();
}
function onGameLose() {
onGameEnd();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SFX, "Lose.wav");
showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.EndScreen(mcTimeline.mcScreens.mcLose), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, setGamePhase, com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING));
}
function onGameWon() {
onGameEnd();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SFX, "Win.wav");
showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.EndScreen(mcTimeline.mcScreens.mcWin), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, setGamePhase, com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING));
var _local2 = SharedObject.getLocal(sSO_NAME);
_local2.data.bAvailable = true;
var _local3 = _local2.flush();
_local2.close();
}
function doSoundEvent(_nEvent, _oSound) {
if (_nEvent == com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE) {
switch (_oSound) {
case oMusicGame :
delete oMusicGame;
break;
case oMusicPack :
delete oMusicPack;
}
}
}
function startMusicForPhase(_nPhase) {
if (com.sarbakan.sound.SoundManager.Inited) {
if (_nPhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
stopMusicPackaging();
startMusicGame();
} else {
stopMusicGame();
startMusicPackaging();
}
}
}
function stopMusicPackaging() {
oMusicPack.doFadeTo(0);
}
function startMusicPackaging() {
if (oMusicPack == undefined) {
oMusicPack = com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_MUSIC, "Music_Packaging.wav", 0, 99999);
oMusicPack.doAddListener(this);
}
oMusicPack.doFadeTo(100);
}
function stopMusicGame() {
oMusicGame.doFadeTo(0);
}
function startMusicGame() {
if (oMusicGame == undefined) {
oMusicGame = com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_MUSIC, "Music_Game.wav", 0, 99999);
oMusicGame.doAddListener(this);
}
oMusicGame.doFadeTo(100);
}
function clearGame() {
oGame.destroy();
oMainBroadcaster.removeListener(oGame);
delete oGame;
}
static var sTRANSITION_DEFAULT = "default";
static var sSOUND_CAT_MUSIC = "Music";
static var sSOUND_CAT_SFX = "Sfx";
static var nSOUND_VOL_MUSIC = 60;
static var nSOUND_VOL_SFX = 100;
static var nSOUND_MC_DEPTH = 2500;
static var sSO_NAME = "DISNEY_RACERS_ADDON_DRIVER";
}
Symbol 930 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.GameData] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.GameData
{
function GameData () {
}
static var nTOON_RACE_1_LAPS = 5;
static var nTOON_RACE_2_LAPS = 5;
static var nTOON_RACE_3_LAPS = 5;
static var nMIRROR_RACE_1_LAPS = 5;
static var nMIRROR_RACE_2_LAPS = 5;
static var nMIRROR_RACE_3_LAPS = 5;
static var nSTAMINA_USE_FOR_SINGLE_ATTACK = 3;
static var nHEALTH_LOSS_REGULAR = 2;
static var nHEALTH_LOSS_SPECIAL = 5;
static var nHEALTH_LOSS_CAR = 1;
static var nHEALTH_LOSS_WEAPON = 12.5;
static var nHEALTH_REGAIN_BONUS = 33;
static var nSTAMINA_REGAIN_BONUS = 100;
static var nDEFAULT_ACCELERATION = 1;
static var nDEFAULT_BRAKING = 1.2;
static var nDEFAULT_MAX_SPEED = 24;
static var nCRUISE_FRICTION = 0.4;
static var nFULLTHROTTLE_MULT = 1.5;
static var nFULLTHROTTLE_DURATION = 150;
static var nSPEED_BOOST_AT_START = 3;
static var nBONUS_CATCH_DIST = 70;
static var nINVINCIBILITY_DURATION = 10;
static var nCAMERA_POINT_LENGTH_IN_FRONT = 150;
static var nMIN_NEXT_NODE_DIST_FOR_BOOST = 300;
static var nTAKE_BOOST_PROBABILITY = 6;
static var nSHOOT_OPPONENT_DELAY = 10;
static var nSHOOT_OPPONENT_PROBABILITY = 12.5;
static var nSHOOT_OPPONENT_ANGL = 20;
static var nSHOOT_OPPONENT_DIST = 225;
static var nATTACK_MOVE_SPEED = 12;
static var nBONUS_HIDE_TIME = 60;
static var nSPECIAL_OBSTACLE_WAVE_WAIT = 180;
static var oPOINTS_PER_RANK = {Pos1:10, Pos2:7, Pos3:4, Pos4:1};
}
Symbol 931 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.GameEngine] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.GameEngine
{
static var s_oInstance;
var oController, mcRef, bCompletedToon, bCompletedMirror, bCompletedLTS, oLevelManager, oPlayerCarType, aMaps2Play, nPlayMode, aContestantsData, nPointsBonuses, nPointsDamage, nPointsStamina;
function GameEngine (_oController, _mcGame) {
oController = _oController;
mcRef = _mcGame;
s_oInstance = this;
bCompletedToon = false;
bCompletedMirror = false;
bCompletedLTS = false;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().disallowInstructions();
updateHUD();
}
static function getInstance() {
return(s_oInstance);
}
function init() {
mcRef.gotoAndStop(sSECTION_EMPTY);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.RacerScreen(com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().mcTimeline.mcScreens.mcRacers));
}
function destroy() {
delete oController;
oLevelManager.destroy();
delete oLevelManager;
delete mcRef;
oPlayerCarType.destroy();
delete oPlayerCarType;
if (aMaps2Play.length != undefined) {
var _local2 = aMaps2Play.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo(aMaps2Play[_local2]).destroy();
}
}
delete s_oInstance;
}
function onUpdate() {
}
function backToCarSelect() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.RacerScreen(com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().mcTimeline.mcScreens.mcRacers), false, com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT);
}
function userSelectedMode(_nMode) {
nPlayMode = _nMode;
aMaps2Play = new Array();
aContestantsData = new Array();
var _local3 = new Array();
var _local4 = new com.disney.gem.games.mickeyFriendsTownRace.game.CarInfo();
_local4.sCarLinkage = oPlayerCarType.sVisualLinkage;
_local4.fCarTypeDecorator = oPlayerCarType.fClassConstructor;
_local4.fCarControlDecorator = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman;
_local3.push(_local4);
var _local5 = new com.disney.gem.games.mickeyFriendsTownRace.game.ContestantInfo();
var _local6 = new _local4.fCarTypeDecorator();
_local5.nCarType = _local6.nCarType;
_local5.nControllerType = nCONTROLLER_HUMAN;
aContestantsData.push(_local5);
var _local7 = [com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMickey, com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMinnie, com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeGoofy, com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeDonald];
var _local8 = _local7.length - 1;
for ( ; (_local8 >= 0) && (_local7.length != undefined) ; _local8--) {
var _local9 = Function(_local7[_local8]);
if (_local9 != oPlayerCarType.fClassConstructor) {
var _local10 = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase(new _local9[undefined]());
var _local11 = new com.disney.gem.games.mickeyFriendsTownRace.game.CarInfo();
_local11.sCarLinkage = _local10.sVisualLinkage;
_local11.fCarTypeDecorator = _local10.fClassConstructor;
_local11.fCarControlDecorator = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerComputer;
_local3.push(_local11);
var _local12 = new com.disney.gem.games.mickeyFriendsTownRace.game.ContestantInfo();
_local6 = new _local11.fCarTypeDecorator();
_local12.nCarType = _local6.nCarType;
_local12.nControllerType = nCONTROLLER_CPU;
aContestantsData.push(_local12);
}
}
var _local13 = new com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo();
var _local14 = new com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo();
var _local15 = new com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo();
switch (nPlayMode) {
case nPLAYMODE_TOON :
_local13.sMapLinkage = "MAP_Toon_Level1";
_local14.sMapLinkage = "MAP_Toon_Level2";
_local15.sMapLinkage = "MAP_Toon_Level3";
_local13.nLapsReq = com.disney.gem.games.mickeyFriendsTownRace.GameData.nTOON_RACE_1_LAPS;
_local14.nLapsReq = com.disney.gem.games.mickeyFriendsTownRace.GameData.nTOON_RACE_2_LAPS;
_local15.nLapsReq = com.disney.gem.games.mickeyFriendsTownRace.GameData.nTOON_RACE_3_LAPS;
_local13.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_NORMAL;
_local14.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_NORMAL;
_local15.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_NORMAL;
break;
case nPLAYMODE_MIRROR :
_local13.sMapLinkage = "MAP_Mirror_Level1";
_local14.sMapLinkage = "MAP_Mirror_Level2";
_local15.sMapLinkage = "MAP_Mirror_Level3";
_local13.nLapsReq = com.disney.gem.games.mickeyFriendsTownRace.GameData.nMIRROR_RACE_1_LAPS;
_local14.nLapsReq = com.disney.gem.games.mickeyFriendsTownRace.GameData.nMIRROR_RACE_2_LAPS;
_local15.nLapsReq = com.disney.gem.games.mickeyFriendsTownRace.GameData.nMIRROR_RACE_3_LAPS;
_local13.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_NORMAL;
_local14.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_NORMAL;
_local15.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_NORMAL;
break;
case nPLAYMODE_LAST :
_local13.sMapLinkage = "MAP_LTS_Level1";
_local14.sMapLinkage = "MAP_LTS_Level2";
_local15.sMapLinkage = "MAP_LTS_Level3";
_local13.nLapsReq = Number.POSITIVE_INFINITY;
_local14.nLapsReq = Number.POSITIVE_INFINITY;
_local15.nLapsReq = Number.POSITIVE_INFINITY;
_local13.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_LAST_STANDING;
_local14.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_LAST_STANDING;
_local15.nLevelType = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_LAST_STANDING;
}
_local13.aCars = _local3;
_local14.aCars = _local3;
_local15.aCars = _local3;
aMaps2Play.push(_local13);
aMaps2Play.push(_local14);
aMaps2Play.push(_local15);
playNextRace();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().allowInstructions();
}
function startGameWithCar(_oCar) {
oPlayerCarType = _oCar;
oController.setScore(0);
showModeSelectionScreen();
}
function showModeSelectionScreen() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.ModeScreen(com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().mcTimeline.mcScreens.mcMode), false, com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT);
}
function playNextRace() {
if (aMaps2Play.length > 0) {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oTransitionManager.playTransition(com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, createLevel), com.sarbakan.utils.Delegate.create(this, relayTransitionComplete));
} else {
defineCupResult();
}
}
function onRaceComplete(_nPosition) {
var _local3 = oLevelManager.getAllCars();
var _local4 = 0;
for ( ; _local4 <= (_local3.length - 1) ; _local4++) {
var _local5 = com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_local3[_local4]);
var _local6 = 0;
for ( ; _local6 <= (aContestantsData.length - 1) ; _local6++) {
var _local7 = aContestantsData[_local6];
if (_local5.oCarType.nCarType == _local7.nCarType) {
addPointToContestant(_local5.nFinalPosition, _local7);
}
}
}
nPointsBonuses = Math.round(oLevelManager.nPointsBonuses);
nPointsDamage = Math.round(oLevelManager.nPointsDamage);
nPointsStamina = Math.round(oLevelManager.nPointsStamina);
var _local8 = (nPointsBonuses + nPointsDamage) + nPointsStamina;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.RaceCompleteScreen(com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().mcTimeline.mcScreens.mcRaceComplete), false, com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, unloadLevel));
var _local9 = 0;
switch (nPlayMode) {
case nPLAYMODE_TOON :
_local9 = _local8 - com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().nPointsCupToon;
break;
case nPLAYMODE_MIRROR :
_local9 = _local8 - com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().nPointsCupMirror;
break;
case nPLAYMODE_LAST :
_local9 = _local8 - com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().nPointsCupLTS;
}
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().increaseScore(Math.max(0, _local9));
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().onLevelEnd();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().startMusicForPhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING);
}
function getHUD() {
return(mcRef.mcHud);
}
function onBtMenu() {
oController.pause();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
oController.showPopup(new com.disney.gem.games.mickeyFriendsTownRace.popups.MenuPopup(oController.mcTimeline.mcPopups.mcMenu), true);
}
function defineCupResult() {
var _local2 = 0;
var _local3 = 0;
var _local4 = aContestantsData.length - 1;
for ( ; (_local4 >= 0) && (aContestantsData.length != undefined) ; _local4--) {
var _local5 = aContestantsData[_local4];
switch (_local5.nControllerType) {
case nCONTROLLER_HUMAN :
_local2 = _local5.nPoints;
break;
case nCONTROLLER_CPU :
_local3 = Math.max(_local3, _local5.nPoints);
}
}
var _local6 = _local2 >= _local3;
if (_local6) {
switch (nPlayMode) {
case nPLAYMODE_TOON :
bCompletedToon = true;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.CupWinScreen(com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().mcTimeline.mcScreens.mcWinToon), false, com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT);
break;
case nPLAYMODE_MIRROR :
bCompletedMirror = true;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().showScreen(new com.disney.gem.games.mickeyFriendsTownRace.screens.CupWinScreen(com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().mcTimeline.mcScreens.mcWinMirror), false, com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT);
break;
case nPLAYMODE_LAST :
bCompletedLTS = true;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().onGameWon();
}
} else {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().onGameLose();
}
}
function addPointToContestant(_nRank, _oContestant) {
var _local4 = oPOINTS_PER_RANK["Pos" + _nRank];
_oContestant.nPreviousPoints = _oContestant.nPoints;
_oContestant.nPoints = _oContestant.nPoints + _local4;
}
function unloadLevel() {
mcRef.gotoAndStop(sSECTION_EMPTY);
oLevelManager.destroy();
delete oLevelManager;
}
function relayTransitionComplete() {
oLevelManager.onInitialTransitionOver();
}
function createLevel() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().hideCurrentScreen();
mcRef.gotoAndStop(sSECTION_GAME);
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo(aMaps2Play.shift());
var _local3 = function (_o1, _o2) {
if (Math.random() < 0.5) {
return(1);
}
return(-1);
};
_local2.aCars.sort(_local3);
oLevelManager = new com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager(mcRef.mcLevel, this, _local2);
var _local4 = 0;
switch (nPlayMode) {
case nPLAYMODE_TOON :
_local4 = 1;
break;
case nPLAYMODE_MIRROR :
_local4 = 2;
break;
case nPLAYMODE_LAST :
_local4 = 3;
}
oController.setLevel(_local4);
oController.onLevelStart();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().startMusicForPhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME);
updateHUD();
}
function updateHUD() {
mcRef.mcHud.btMenu.onRelease = com.sarbakan.utils.Delegate.create(this, onBtMenu);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcHud.btMenu);
}
static var sSECTION_EMPTY = "Empty";
static var sSECTION_GAME = "Game";
static var nPLAYMODE_TOON = 1;
static var nPLAYMODE_MIRROR = 2;
static var nPLAYMODE_LAST = 3;
static var nCAR_MICKEY = 1;
static var nCAR_MINNIE = 2;
static var nCAR_GOOFY = 3;
static var nCAR_DONALD = 4;
static var nCONTROLLER_HUMAN = 1;
static var nCONTROLLER_CPU = 2;
static var oPOINTS_PER_RANK = com.disney.gem.games.mickeyFriendsTownRace.GameData.oPOINTS_PER_RANK;
}
Symbol 932 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager
{
static var s_oInstance;
var mcRef, oGoPop, oGoPopLTS, oRaceOverPop, oFinishedPop, oParentGame, oLevelInfo, nCarsThatCompleted, nCarDead, nPointsBonuses, nPointsDamage, nPointsStamina, mcMapInfo, bPrepare, aAttacks, aCarsControllers, oCamera, aRouteNodes, oStartLineRouteNode, mcRace, aObstacles, aBonuses, aMapBitmaps, oCameraStart, oCollisionBitmap, oSlidingBitmap, oReactionManager, oStartLinePt1Coord, oStartLinePt2Coord, oSpecialObstacleInfo, oSpecialObstacle, nStartLineRotation, aBonuses2Create, nMapWidth, nMapHeight, nReactionMapRatio;
function LevelManager (_mcRef, _oParentGame, _oLevelInfo) {
mcRef = _mcRef;
mcRef.mc321Go.swapDepths(nDEPTH_GO_ANIM);
mcRef.mc321GoLTS.swapDepths(nDEPTH_GO_ANIM_LTS);
mcRef.mcRaceOver.swapDepths(nDEPTH_RACEOVER);
mcRef.mcFinished.swapDepths(nDEPTH_FINISHED);
oGoPop = new com.disney.gem.games.mickeyFriendsTownRace.game.GoAnim(mcRef.mc321Go);
oGoPopLTS = new com.disney.gem.games.mickeyFriendsTownRace.game.GoAnim(mcRef.mc321GoLTS);
oRaceOverPop = new com.disney.gem.games.mickeyFriendsTownRace.game.FinalAnim(mcRef.mcRaceOver);
oFinishedPop = new com.disney.gem.games.mickeyFriendsTownRace.game.FinalAnim(mcRef.mcFinished);
s_oInstance = this;
oParentGame = _oParentGame;
oLevelInfo = _oLevelInfo;
nCarsThatCompleted = 0;
nCarDead = 0;
nPointsBonuses = 0;
nPointsDamage = 0;
nPointsStamina = 0;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
mcMapInfo = mcRef.attachMovie(oLevelInfo.sMapLinkage, "mcMapInfo", nDEPTH_MAP_INFO);
bPrepare = true;
aAttacks = new Array();
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().gotoAndStop(oLevelInfo.nLevelType);
}
static function getInstance() {
return(s_oInstance);
}
function castBoostSound(_oCoord) {
var _local3 = Math.abs(_oCoord.subtract(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.oCoord).length);
if (_local3 < nSOUND_CAST_DIST_MAX) {
if (_local3 > nSOUND_CAST_DIST_MIN) {
var _local4 = 1 - ((_local3 - nSOUND_CAST_DIST_MIN) / (nSOUND_CAST_DIST_MAX - nSOUND_CAST_DIST_MIN));
} else {
var _local4 = 1;
}
var _local5 = Math.round(_local4 * 100);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "Boost_Vitesse.wav");
}
}
function castAttackHitSound(_nType, _oCoord) {
var _local4 = Math.abs(_oCoord.subtract(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.oCoord).length);
if (_local4 < nSOUND_CAST_DIST_MAX) {
if (_local4 > nSOUND_CAST_DIST_MIN) {
var _local5 = (_local4 - nSOUND_CAST_DIST_MIN) / (nSOUND_CAST_DIST_MAX - nSOUND_CAST_DIST_MIN);
} else {
var _local5 = 1;
}
var _local6 = Math.round(_local5 * 100);
switch (_nType) {
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_DONALD :
var _local7 = "Attack_Donald_Hit.wav";
break;
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_GOOFY :
_local7 = "Attack_Goofy_Hit.wav";
break;
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_MICKEY :
_local7 = "Attack_Mickey_Hit.wav";
break;
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_MINNIE :
_local7 = "Attack_Minnie_Hit.wav";
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, _local7, _local6);
}
}
function castAttackSound(_nType, _oCoord) {
var _local4 = Math.abs(_oCoord.subtract(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.oCoord).length);
if (_local4 < nSOUND_CAST_DIST_MAX) {
if (_local4 > nSOUND_CAST_DIST_MIN) {
var _local5 = (_local4 - nSOUND_CAST_DIST_MIN) / (nSOUND_CAST_DIST_MAX - nSOUND_CAST_DIST_MIN);
} else {
var _local5 = 1;
}
var _local6 = Math.round(_local5 * 100);
switch (_nType) {
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_DONALD :
var _local7 = "Attack_Donald.wav";
break;
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_GOOFY :
_local7 = "Attack_Goofy.wav";
break;
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_MICKEY :
_local7 = "Attack_Mickey.wav";
break;
case com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_MINNIE :
_local7 = "Attack_Minnie.wav";
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, _local7, _local6);
}
}
function castRacerCollisionSound(_oCoord) {
var _local3 = Math.abs(_oCoord.subtract(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.oCoord).length);
if (_local3 < nSOUND_CAST_DIST_MAX) {
if (_local3 > nSOUND_CAST_DIST_MIN) {
var _local4 = (_local3 - nSOUND_CAST_DIST_MIN) / (nSOUND_CAST_DIST_MAX - nSOUND_CAST_DIST_MIN);
} else {
var _local4 = 1;
}
var _local5 = Math.round(_local4 * 100);
var _local6 = ("Collision_Racer_" + com.sarbakan.utils.MoreMath.getRandomRange(1, 6)) + ".wav";
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, _local6, _local5);
}
}
function castWallCollisionSound(_oCoord) {
var _local3 = Math.abs(_oCoord.subtract(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.oCoord).length);
if (_local3 < nSOUND_CAST_DIST_MAX) {
if (_local3 > nSOUND_CAST_DIST_MIN) {
var _local4 = (_local3 - nSOUND_CAST_DIST_MIN) / (nSOUND_CAST_DIST_MAX - nSOUND_CAST_DIST_MIN);
} else {
var _local4 = 1;
}
var _local5 = Math.round(_local4 * 100);
var _local6 = ("Collision_Mur_" + com.sarbakan.utils.MoreMath.getRandomRange(1, 7)) + ".wav";
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, _local6, _local5);
}
}
function goAnimComplete() {
var _local2 = aCarsControllers.length - 1;
for ( ; (_local2 >= 0) && (aCarsControllers.length != undefined) ; _local2--) {
var _local3 = aCarsControllers[_local2];
_local3.startRace();
}
}
function cameraMoveOver() {
if (oLevelInfo.nLevelType == com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_LAST_STANDING) {
oGoPopLTS.showGo(com.sarbakan.utils.Delegate.create(this, goAnimComplete), true);
} else {
oGoPop.showGo(com.sarbakan.utils.Delegate.create(this, goAnimComplete));
}
}
function getCamera() {
return(oCamera);
}
function onInitialTransitionOver() {
oCamera.setTarget(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar);
}
function onCarDeadGetRank() {
var _local2 = aCarsControllers.length - nCarDead;
nCarDead++;
if (oLevelInfo.nLevelType == com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo.nRACE_TYPE_LAST_STANDING) {
if (nCarDead >= (aCarsControllers.length - 1)) {
var _local3 = aCarsControllers.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
var _local4 = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase(aCarsControllers[_local3]).oCar;
if (!_local4.bDead) {
onCarCompleteRace(_local4);
}
}
}
}
return(_local2);
}
function onCarCompleteRace(_oCar) {
_oCar.stopMoveRaceEnd();
nCarsThatCompleted++;
_oCar.nFinalPosition = nCarsThatCompleted;
if (com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar == _oCar) {
nPointsStamina = (_oCar.getHealthPercentage() * 100) * 20;
com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.startEndWatch();
calculateCpusPosition();
oFinishedPop.showAnim(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.nFinalPosition);
}
}
function showPlayerDiedPop() {
oRaceOverPop.showAnim();
}
function calculateCpusPosition() {
var _local2 = aCarsControllers.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
var _local3 = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase(aCarsControllers[_local2]).oCar;
if (_local3.nFinalPosition == undefined) {
_local3.calculatePosition();
_local3.nFinalPosition = _local3.nRank;
}
}
}
function onPlayerComplete(_nRank) {
oParentGame.onRaceComplete(_nRank);
}
function onUpdate() {
if (bPrepare) {
bPrepare = false;
var _local2 = getTimer();
generateMapData();
createRace();
sortRouteNodes();
addCars();
addSpecialObstacle();
var _local3 = getTimer();
var _local4 = _local3 - _local2;
}
}
function getRouteNodeNum(_nNum) {
if (_nNum <= aRouteNodes.length) {
do {
if ((in aRouteNodes) == null) {
break;
}
var _local4 = in aRouteNodes;
var _local3 = aRouteNodes[_local4];
} while (_local3.nNum != _nNum);
do {
} while ("getRouteNodeNum" != null);
} else {
var _local3 = oStartLineRouteNode;
}
return(_local3);
}
function removeAttack(_oAttack) {
var _local3 = aAttacks.length - 1;
for ( ; (_local3 >= 0) && (aAttacks.length != undefined) ; _local3--) {
if (aAttacks[_local3] == _oAttack) {
aAttacks.splice(_local3, 1);
}
}
}
function addAttack(_oAttack) {
aAttacks.push(_oAttack);
}
function getAttachedAttack(_sLinkage) {
var _local3 = nDEPTH_ATTACKS + aAttacks.length;
while (mcRace.getInstanceAtDepth(_local3) != undefined) {
_local3++;
}
return(mcRace.attachMovie(_sLinkage, "mcAttack" + _local3, _local3));
}
function getLapsQty() {
return(oLevelInfo.nLapsReq);
}
function getAllAttacks() {
return(aAttacks);
}
function getAllObstacles() {
return(aObstacles);
}
function getAllBonuses() {
return(aBonuses);
}
function getAllCars() {
var _local2 = new Array();
var _local3 = aCarsControllers.length - 1;
for ( ; (_local3 >= 0) && (aCarsControllers.length != undefined) ; _local3--) {
_local2.push(com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase(aCarsControllers[_local3]).oCar);
}
return(_local2);
}
function getPositionForCar(_oCar) {
var _local3 = getAllCars();
var _local4 = _local3.length - 1;
for ( ; (_local4 >= 0) && (_local3.length != undefined) ; _local4--) {
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_local3[_local4]).bDead) {
_local3.splice(_local4, 1);
}
}
var _local5 = function (_oCar1, _oCar2) {
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar1).nLapsCompleted > com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar2).nLapsCompleted) {
return(-1);
}
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar1).nLapsCompleted < com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar2).nLapsCompleted) {
return(1);
}
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar1).getCurrentNodeNum() > com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar2).getCurrentNodeNum()) {
return(-1);
}
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar1).getCurrentNodeNum() < com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar2).getCurrentNodeNum()) {
return(1);
}
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar1).getDistanceFromTargetNode() < com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar2).getDistanceFromTargetNode()) {
return(-1);
}
if (com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar1).getDistanceFromTargetNode() > com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_oCar2).getDistanceFromTargetNode()) {
return(1);
}
return(0);
};
_local3.sort(_local5);
var _local6 = 1;
// unexpected jump
do {
_local6++;
if (_local6 > _local3.length) {
break;
}
} while (_local3[_local6 - 1] != _oCar);
return(_local6);
}
function destroy() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
var _local2 = aCarsControllers.length - 1;
for ( ; (_local2 >= 0) && (aCarsControllers.length != undefined) ; _local2--) {
com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase(aCarsControllers[_local2]).oCar.destroy();
com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase(aCarsControllers[_local2]).destroy();
}
delete aCarsControllers;
var _local3 = aMapBitmaps.length - 1;
for ( ; (_local3 >= 0) && (aMapBitmaps.length != undefined) ; _local3--) {
com.disney.gem.games.mickeyFriendsTownRace.game.map.PartialMapBitmap(aMapBitmaps[_local3]).destroy();
}
delete aMapBitmaps;
oCamera.destroy();
delete oCameraStart;
delete oCollisionBitmap;
delete oSlidingBitmap;
oLevelInfo.destroy();
delete oLevelInfo;
delete oParentGame;
oReactionManager.destroy();
delete oReactionManager;
delete oStartLinePt1Coord;
delete oStartLinePt2Coord;
delete oParentGame;
delete s_oInstance;
delete mcRef;
mcRace.removeMovieClip();
delete mcRace;
}
function toString() {
return("[LevelManager]");
}
function addSpecialObstacle() {
var _local2 = mcRace.attachMovie(oSpecialObstacleInfo.sLinkage, "mcSpecialOb", nDEPTH_SPECIAL_OB);
_local2._x = oSpecialObstacleInfo.nX;
_local2._y = oSpecialObstacleInfo.nY;
_local2._rotation = oSpecialObstacleInfo.nRotation;
oSpecialObstacle = new com.disney.gem.games.mickeyFriendsTownRace.game.SpecialObstacle(_local2);
}
function addCars() {
aCarsControllers = new Array();
var _local2 = oLevelInfo.aCars.length;
var _local3 = 0;
for ( ; _local3 <= (_local2 - 1) ; _local3++) {
var _local4 = oLevelInfo.aCars[_local3];
var _local5 = flash.geom.Point.interpolate(oStartLinePt1Coord, oStartLinePt2Coord, (1 / (_local2 + 1)) * (_local3 + 1));
createCarAt(_local4, _local5);
}
}
function createCarAt(_oCarInfo, _oPutPoint) {
var _local4 = nDEPTH_CARS + aCarsControllers.length;
var _local5 = mcRace.attachMovie(_oCarInfo.sCarLinkage, "mcCar" + _local4, _local4);
_local5._x = _oPutPoint.x;
_local5._y = _oPutPoint.y;
_local5._rotation = nStartLineRotation;
var _local6 = new com.disney.gem.games.mickeyFriendsTownRace.game.CarBase(_local5);
var _local7 = new _oCarInfo.fCarTypeDecorator();
_local6.setCarType(_local7);
var _local8 = new _oCarInfo.fCarControlDecorator(_local6);
_local6.nCarID = aCarsControllers.length;
aCarsControllers.push(_local8);
}
function createRace() {
mcRace = mcRef.createEmptyMovieClip("mcRace", nDEPTH_RACE);
var _local2 = Number.POSITIVE_INFINITY;
var _local3 = Number.NEGATIVE_INFINITY;
var _local4 = Number.POSITIVE_INFINITY;
var _local5 = Number.NEGATIVE_INFINITY;
var _local6 = 0;
for ( ; _local6 <= (aMapBitmaps.length - 1) ; _local6++) {
var _local7 = aMapBitmaps[_local6];
var _local8 = mcRace.createEmptyMovieClip("mcPart_" + _local7.sPartName, mcRace.getNextHighestDepth());
_local8._x = _local7.oCoordinates.x;
_local8._y = _local7.oCoordinates.y;
_local8.attachBitmap(_local7.oBitmapData, 1);
_local2 = Math.min(_local8._y, _local2);
_local3 = Math.max(_local8._y + _local8._height, _local3);
_local4 = Math.min(_local8._x, _local4);
_local5 = Math.max(_local8._x + _local8._width, _local5);
}
aBonuses = new Array();
var _local9 = 0;
for ( ; _local9 <= (aBonuses2Create.length - 1) ; _local9++) {
var _local10 = aBonuses2Create[_local9];
var _local11 = mcRace.attachMovie(_local10.sLinkage, "mcBonus" + _local9, nDEPTH_BONUSES + _local9);
_local11._x = _local10.nX;
_local11._y = _local10.nY;
_local11._rotation = _local10.nRotation;
switch (_local10.sLinkage) {
case "mcBonusSpeed" :
var _local12 = com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_SPEED;
break;
case "mcBonusPts5K" :
_local12 = com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_POINTS_5K;
break;
case "mcBonusToon" :
_local12 = com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_TOON;
break;
case "mcBonusPts2K" :
_local12 = com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_POINTS_2K;
break;
case "mcBonusRepair" :
_local12 = com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_REPAIR;
}
var _local13 = new com.disney.gem.games.mickeyFriendsTownRace.game.Bonus(_local11, _local12);
aBonuses.push(_local13);
}
if (aObstacles.length != undefined) {
var _local14 = 0;
for ( ; _local14 <= (aObstacles.length - 1) ; _local14++) {
var _local15 = aObstacles[_local14];
var _local16 = mcRace.attachMovie("mcHitRound", "crap" + _local14, 565665 + Number(_local14));
_local16._x = _local15.oCoord.x;
_local16._y = _local15.oCoord.y;
}
}
var _local17 = new flash.geom.Rectangle(_local4, _local2, _local5 - _local4, _local3 - _local2);
var _local18 = com.sarbakan.utils.Delegate.create(this, cameraMoveOver);
oCamera = new com.disney.gem.games.mickeyFriendsTownRace.game.map.RaceCamera(mcRace, _local17, oCameraStart, _local18);
}
function generateMapData() {
nMapWidth = Math.floor(mcMapInfo.mcCornerBR._x - mcMapInfo.mcCornerTL._x);
nMapHeight = Math.floor(mcMapInfo.mcCornerBR._y - mcMapInfo.mcCornerTL._y);
var _local2 = new flash.geom.Point(mcMapInfo.mcCornerTL._x - mcMapInfo.mcVisual._x, mcMapInfo.mcCornerTL._y - mcMapInfo.mcVisual._y);
aMapBitmaps = new Array();
var _local3 = Math.ceil(nMapWidth / 2880);
var _local4 = Math.ceil(nMapHeight / 2880);
nMapWidth = nMapWidth - (nMapWidth % _local3);
nMapHeight = nMapHeight - (nMapHeight % _local4);
var _local5 = nMapWidth / _local3;
var _local6 = nMapHeight / _local4;
var _local7 = 1;
for ( ; _local7 <= _local3 ; _local7++) {
var _local8 = 1;
for ( ; _local8 <= _local4 ; _local8++) {
var _local9 = (_local7 - 1) * _local5;
var _local10 = (_local8 - 1) * _local6;
var _local11 = new flash.display.BitmapData(_local5, _local6, false, 2434341);
var _local12 = mcMapInfo.mcVisual.transform.matrix.clone();
_local12.tx = -_local2.x;
_local12.ty = -_local2.y;
_local12.tx = _local12.tx - _local9;
_local12.ty = _local12.ty - _local10;
_local11.draw(mcMapInfo.mcVisual, _local12);
var _local13 = new com.disney.gem.games.mickeyFriendsTownRace.game.map.PartialMapBitmap();
_local13.oBitmapData = _local11;
_local13.sPartName = (_local7 + "_") + _local8;
_local13.oCoordinates = new flash.geom.Point(_local9, _local10);
aMapBitmaps.push(_local13);
}
}
var _local16 = 1;
if ((nMapHeight > 2880) || (nMapWidth > 2880)) {
var _local17 = 2880 / nMapWidth;
var _local18 = 2880 / nMapHeight;
_local16 = Math.min(_local18, _local17);
}
var _local14 = Math.floor(nMapWidth * _local16);
var _local15 = Math.floor(nMapHeight * _local16);
var _local19 = new flash.filters.ColorMatrixFilter(aCONTRAST_MATRIX);
oCollisionBitmap = new flash.display.BitmapData(_local14, _local15, false, 16777215);
var _local20 = mcMapInfo.mcCollisions.transform.matrix.clone();
_local2 = new flash.geom.Point(mcMapInfo.mcCornerTL._x - mcMapInfo.mcCollisions._x, mcMapInfo.mcCornerTL._y - mcMapInfo.mcCollisions._y);
_local20.tx = -_local2.x;
_local20.ty = -_local2.y;
_local20.scale(_local16, _local16);
oCollisionBitmap.draw(mcMapInfo.mcCollisions, _local20);
nReactionMapRatio = _local16;
oCollisionBitmap.generateFilterRect(oCollisionBitmap.rectangle, _local19);
aObstacles = new Array();
for (var i in mcMapInfo.mcVisual.mcObstacles) {
var _local21 = mcMapInfo.mcVisual.mcObstacles[i];
var _local22 = ((_local21._x + mcMapInfo.mcVisual._x) + mcMapInfo.mcVisual.mcObstacles._x) - mcMapInfo.mcCornerTL._x;
var _local23 = ((_local21._y + mcMapInfo.mcVisual._y) + mcMapInfo.mcVisual.mcObstacles._y) - mcMapInfo.mcCornerTL._y;
var _local24 = new flash.geom.Point(_local22, _local23);
var _local25 = Math.max(_local21._height, _local21._width);
var _local26 = new com.disney.gem.games.mickeyFriendsTownRace.game.Obstacle(_local24, _local25);
aObstacles.push(_local26);
}
oSlidingBitmap = new flash.display.BitmapData(_local14, _local15, false, 16777215);
_local20 = mcMapInfo.mcSliding.transform.matrix.clone();
_local2 = new flash.geom.Point(mcMapInfo.mcCornerTL._x - mcMapInfo.mcSliding._x, mcMapInfo.mcCornerTL._y - mcMapInfo.mcSliding._y);
_local20.tx = -_local2.x;
_local20.ty = -_local2.y;
_local20.scale(_local16, _local16);
oSlidingBitmap.draw(mcMapInfo.mcSliding, _local20);
oSlidingBitmap.generateFilterRect(oSlidingBitmap.rectangle, _local19);
oReactionManager = new com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager(oCollisionBitmap, oSlidingBitmap, nReactionMapRatio);
var _local27 = mcMapInfo.mcStartLine.mcPt1.getBounds(mcMapInfo);
oStartLinePt1Coord = new flash.geom.Point(com.sarbakan.utils.MoreMath.getBoundsCenter(_local27).x - mcMapInfo.mcCornerTL._x, com.sarbakan.utils.MoreMath.getBoundsCenter(_local27).y - mcMapInfo.mcCornerTL._y);
var _local28 = mcMapInfo.mcStartLine.mcPt2.getBounds(mcMapInfo);
oStartLinePt2Coord = new flash.geom.Point(com.sarbakan.utils.MoreMath.getBoundsCenter(_local28).x - mcMapInfo.mcCornerTL._x, com.sarbakan.utils.MoreMath.getBoundsCenter(_local28).y - mcMapInfo.mcCornerTL._y);
nStartLineRotation = mcMapInfo.mcStartLine._rotation;
var _local29 = new flash.geom.Point(mcMapInfo.mcCameraStart._x, mcMapInfo.mcCameraStart._y);
oCameraStart = new flash.geom.Point(_local29.x - mcMapInfo.mcCornerTL._x, _local29.y - mcMapInfo.mcCornerTL._y);
aRouteNodes = new Array();
var _local30 = new com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode(-1, com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nTYPE_START_LINE, mcMapInfo.mcStartLine._x - mcMapInfo.mcCornerTL._x, mcMapInfo.mcStartLine._y - mcMapInfo.mcCornerTL._y, mcMapInfo.mcStartLine._rotation);
aRouteNodes.push(_local30);
for (var i in mcMapInfo) {
var _local31 = mcMapInfo[i];
if (_local31._name == "mcRouteNode") {
_local31._name = "RN" + Math.abs(_local31.getDepth());
_local30 = new com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode(-1, com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nTYPE_NORMAL, _local31._x - mcMapInfo.mcCornerTL._x, _local31._y - mcMapInfo.mcCornerTL._y, _local31._rotation);
aRouteNodes.push(_local30);
}
}
aBonuses2Create = new Array();
for (var i in mcMapInfo) {
var _local32 = mcMapInfo[i];
if (_local32._name == "mcBonus") {
_local32._name = "B" + Math.abs(_local32.getDepth());
var _local33 = {};
_local33.nX = _local32._x - mcMapInfo.mcCornerTL._x;
_local33.nY = _local32._y - mcMapInfo.mcCornerTL._y;
_local33.nRotation = _local32._rotation;
_local33.sLinkage = _local32.sLinkage;
aBonuses2Create.push(_local33);
}
}
oSpecialObstacleInfo = new Object();
oSpecialObstacleInfo.sLinkage = mcMapInfo.mcSpecialObstacle.sLinkage;
oSpecialObstacleInfo.nX = mcMapInfo.mcSpecialObstacle._x - mcMapInfo.mcCornerTL._x;
oSpecialObstacleInfo.nY = mcMapInfo.mcSpecialObstacle._y - mcMapInfo.mcCornerTL._y;
oSpecialObstacleInfo.nRotation = mcMapInfo.mcSpecialObstacle._rotation;
mcMapInfo.removeMovieClip();
}
function sortRouteNodes() {
var _local2 = aRouteNodes.length - 1;
for ( ; (_local2 >= 0) && (aRouteNodes.length != undefined) ; _local2--) {
if (com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode(aRouteNodes[_local2]).nType == com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nTYPE_START_LINE) {
oStartLineRouteNode = com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode(aRouteNodes[_local2]);
}
}
var _local3 = 1;
oStartLineRouteNode.nNum = _local3;
var _local4 = false;
var _local5 = oStartLineRouteNode;
var _local7 = getTimer();
var _local8 = 0;
while ((!_local4) && (_local8 < 256)) {
var _local6 = getNextNodeFor(_local5);
if (_local6 != _local5) {
if (_local6.nType != com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nTYPE_START_LINE) {
_local3++;
_local6.nNum = _local3;
_local5 = _local6;
} else {
_local4 = true;
}
_local8++;
} else {
break;
}
}
var _local9 = getTimer();
var _local10 = _local9 - _local7;
var _local11 = aRouteNodes.length - 1;
for ( ; (_local11 >= 0) && (aRouteNodes.length != undefined) ; _local11--) {
var _local12 = aRouteNodes[_local11];
if (_local12.nNum == -1) {
}
}
}
function getNextNodeFor(_oRN) {
var _local3 = 20;
var _local5 = new Array();
var _local6 = aRouteNodes.length - 1;
for ( ; (_local6 >= 0) && (aRouteNodes.length != undefined) ; _local6--) {
var _local7 = aRouteNodes[_local6];
if (_local7 != _oRN) {
var _local8 = _local7.oCoord.subtract(_oRN.oCoord);
var _local9 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(_local8);
var _local10 = _oRN.oRotationVector.angl(_local9);
_local10 = com.sarbakan.utils.MoreMath.getDegreeFromRadius(_local10);
if (_local10 <= _local3) {
_local5.push(_local7);
}
}
}
if (_local5.length > 0) {
var _local11 = Number.POSITIVE_INFINITY;
var _local12 = _local5.length - 1;
for ( ; (_local12 >= 0) && (_local5.length != undefined) ; _local12--) {
var _local13 = com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode(_local5[_local12]);
var _local14 = _local13.oCoord.subtract(_oRN.oCoord).length;
if (_local14 < _local11) {
_local11 = _local14;
var _local4 = _local13;
}
}
} else {
var _local4 = _oRN;
}
return(_local4);
}
static var nREMOVE_DEPTH = 2500;
static var nDEPTH_RACE = 25;
static var nDEPTH_BONUSES = 150;
static var nDEPTH_CARS = 250;
static var nDEPTH_SPECIAL_OB = 500;
static var nDEPTH_ATTACKS = 2500;
static var nDEPTH_GO_ANIM = 500000;
static var nDEPTH_GO_ANIM_LTS = 500001;
static var nDEPTH_RACEOVER = 500002;
static var nDEPTH_FINISHED = 500003;
static var nDEPTH_MAP_INFO = 25000;
static var nSOUND_CAST_DIST_MIN = 100;
static var nSOUND_CAST_DIST_MAX = 750;
static var nVIEWPORT_WIDTH = 580;
static var nVIEWPORT_HEIGHT = 410 - 55;
static var aCONTRAST_MATRIX = [10, 0, 0, 0, -1000, 0, 10, 0, 0, -1000, 0, 0, 10, 0, -1000, 0, 0, 0, 1, 0];
}
Symbol 933 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode
{
var oCoord, nNum, nType, nRotation, oRotationVector;
function RouteNode (_nNum, _nType, _nX, _nY, _nRotation) {
oCoord = new flash.geom.Point(_nX, _nY);
nNum = _nNum;
nType = _nType;
nRotation = _nRotation;
oRotationVector = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
var _local7 = com.sarbakan.utils.MoreMath.getRadianFromDegree(_nRotation);
oRotationVector.vx = Math.cos(_local7);
oRotationVector.vy = Math.sin(_local7);
}
function toString() {
return(("[RouteNode #" + nNum) + "]");
}
static var nTYPE_START_LINE = 1;
static var nTYPE_NORMAL = 2;
static var nACQUIRE_DISTANCE = 200;
}
Symbol 934 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.lib.Vector] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.lib.Vector
{
var _vx, _vy;
function Vector (x, y) {
if (((x == 0) && (y == 0)) || ((x == undefined) || (y == undefined))) {
zero();
} else {
_vx = x;
_vy = y;
}
}
static function Normalize(v) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
var _local4 = v.length();
if (_local4 != 0) {
_local3.vx = v.vx / _local4;
_local3.vy = v.vy / _local4;
}
return(_local3);
}
static function Distance(v1, v2) {
var _local4 = v2.vy - v1.vy;
var _local5 = v2.vx - v1._vx;
return(Math.sqrt((_local4 * _local4) + (_local5 * _local5), 2));
}
static function DistanceSq(v1, v2) {
var _local4 = v2.vy - v1.vy;
var _local5 = v2.vx - v1.vx;
return((_local4 * _local4) + (_local5 * _local5));
}
static function Length(v) {
return(Math.sqrt((v.vx * v.vx) + (v.vy * v.vy), 2));
}
static function PointToVector(p) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(p.x, p.y);
return(_local3);
}
static function VectorToPoint(v) {
var _local3 = new flash.geom.Point(v.vx, v.vy);
return(_local3);
}
static function RotateAroundOrigin(v, ang) {
var _local4 = new flash.geom.Matrix();
_local4.rotate(ang);
var _local5 = VectorToPoint(v);
var _local6 = _local4.transformPoint(_local5);
v = PointToVector(_local6);
return(v);
}
static function GetIntersectionPoint(v1, v2, v3, v4) {
var _local6 = ((v4.vy - v3.vy) * (v2.vx - v1.vx)) - ((v4.vx - v3.vx) * (v2.vy - v1.vy));
var _local7 = (((v4.vx - v3.vx) * (v1.vy - v3.vy)) - ((v4.vy - v3.vy) * (v1.vx - v3.vx))) / _local6;
var _local8 = (((v2.vx - v1.vx) * (v1.vy - v3.vy)) - ((v2.vy - v1.vy) * (v1.vx - v3.vx))) / _local6;
var _local9 = v1.vx + (_local7 * (v2.vx - v1.vx));
var _local10 = v1.vy + (_local7 * (v2.vy - v1.vy));
return(new flash.geom.Point(_local9, _local10));
}
function copy() {
return(new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(vx, vy));
}
function add(v) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(_vx + v.vx, _vy + v.vy);
return(_local3);
}
function angl(v) {
if (isZero() && (!v.isZero())) {
var _local3 = v.vx;
} else if ((!isZero()) && (v.isZero())) {
var _local3 = vx;
} else {
var _local3 = dot(v) / (length() * v.length());
}
var _local4 = Math.acos(_local3);
if (arguments[1] == true) {
var _local5 = (_local4 / Math.PI) * 180;
return(_local5);
}
return(_local4);
}
function sub(v) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(_vx - v.vx, _vy - v.vy);
return(_local3);
}
function mult(n) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(_vx * n, _vy * n);
return(_local3);
}
function div(n) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(_vx / n, _vy / n);
return(_local3);
}
function length() {
return(Math.sqrt((_vx * _vx) + (_vy * _vy), 2));
}
function lengthSq() {
return((_vx * _vx) + (_vy * _vy));
}
function dot(v) {
return((_vx * v.vx) + (_vy * v.vy));
}
function sign(v) {
if ((_vy * v.vx) > (_vx * v.vy)) {
return(-1);
}
return(1);
}
function perp() {
var _local2 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(-_vy, _vx);
return(_local2);
}
function distance(v) {
var _local3 = v.vy - _vy;
var _local4 = v.vx - _vx;
return(Math.sqrt((_local3 * _local3) + (_local4 * _local4), 2));
}
function distanceSq(v) {
var _local3 = v.vy - _vy;
var _local4 = v.vx - _vx;
return((_local3 * _local3) + (_local4 * _local4));
}
function truncate(m) {
if (length() > m) {
normalize();
_vx = _vx * m;
_vy = _vy * m;
}
}
function reflect(v) {
var _local3 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
if (dot(v) != 0) {
_local3.vy = _vy - ((2 * dot(v)) * v.vy);
_local3.vx = _vx - ((2 * dot(v)) * v.vx);
} else {
_local3.vy = getReverse().vy;
_local3.vx = getReverse().vx;
}
return(_local3);
}
function getReverse() {
var _local2 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector(-_vx, -_vy);
return(_local2);
}
function normalize() {
var _local2 = length();
if (_local2 != 0) {
_vx = _vx / _local2;
_vy = _vy / _local2;
}
}
function zero(Void) {
_vx = (_vy = 0);
}
function isZero() {
if ((_vx == 0) && (_vy == 0)) {
return(true);
}
return(false);
}
function toString() {
return((((("vx: " + vx) + ", vy: ") + vy) + ", length: ") + length());
}
function get vx() {
return(_vx);
}
function get vy() {
return(_vy);
}
function set vy(n) {
_vy = n;
//return(vy);
}
function set vx(n) {
_vx = n;
//return(vx);
}
}
Symbol 935 MovieClip [__Packages.com.sarbakan.utils.MoreMath] Frame 0
class com.sarbakan.utils.MoreMath
{
function MoreMath () {
}
static function getRandomRange(__nMin, __nMax) {
return(Math.floor(Math.random() * ((__nMax + 1) - __nMin)) + __nMin);
}
static function getPolarity(__nNum) {
var _local3 = 0;
if (__nNum < 0) {
_local3 = -1;
} else if (__nNum > 0) {
_local3 = 1;
}
return(_local3);
}
static function getReachZero(__nNum, __nReducer) {
return(getReachNum(__nNum, 0, __nReducer));
}
static function getReachNum(__nNum, __nTargetNum, __nReducer) {
var _local5 = __nNum;
if (_local5 != __nTargetNum) {
if (_local5 < __nTargetNum) {
_local5 = _local5 + __nReducer;
if (_local5 > __nTargetNum) {
_local5 = __nTargetNum;
}
} else {
_local5 = _local5 - __nReducer;
if (_local5 < __nTargetNum) {
_local5 = __nTargetNum;
}
}
}
return(_local5);
}
static function getDistance(__nX1, __nY1, __nX2, __nY2) {
return(Math.sqrt(Math.pow(Math.abs(__nX2 - __nX1), 2) + Math.pow(Math.abs(__nY2 - __nY1), 2)));
}
static function getManhattanDistance(_x1, _y1, _x2, _y2) {
return(Math.abs(_x1 - _x2) + Math.abs(_y1 - _y2));
}
static function getHypotenuse(__nDX, __nDY) {
return(Math.sqrt(Math.pow(__nDX, 2) + Math.pow(__nDY, 2)));
}
static function getAngle(__nX1, __nY1, __nX2, __nY2) {
var _local6 = __nX2 - __nX1;
var _local7 = __nY2 - __nY1;
var _local8 = Math.atan2(_local7, _local6);
var _local9 = getDegreeFromRadius(_local8);
return(_local9);
}
static function getCleanedAngle(_nAngle) {
while (_nAngle < 360) {
_nAngle = _nAngle + 360;
}
_nAngle = _nAngle % 360;
return(_nAngle);
}
static function getDegreeFromRadius(__nRadius) {
var _local3 = (__nRadius / MATH_PI) * 180;
return(_local3);
}
static function getRadianFromDegree(__nDegree) {
var _local3 = __nDegree * (MATH_PI / 180);
return(_local3);
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local4 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local4});
}
static var MATH_PI = Math.PI;
}
Symbol 936 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.SpecialObstacle] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.SpecialObstacle extends com.sarbakan.utils.StateManaged
{
var setState, sState, nWaveDelay, stateFinished;
function SpecialObstacle (_mcRef) {
super(_mcRef);
setState(sSTATE_IDLE, true);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
takeNextWaveDelay();
}
function isActive() {
return(sState != sSTATE_IDLE);
}
function destroy() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
super.destroy();
}
function state_Idle() {
nWaveDelay--;
if (nWaveDelay <= 0) {
setState(sSTATE_BLOCK + com.sarbakan.utils.MoreMath.getRandomRange(1, 2), true);
}
}
function state_Block1() {
if (stateFinished()) {
setState(sSTATE_IDLE, true);
takeNextWaveDelay();
}
}
function state_Block2() {
if (stateFinished()) {
setState(sSTATE_IDLE, true);
takeNextWaveDelay();
}
}
function takeNextWaveDelay() {
nWaveDelay = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSPECIAL_OBSTACLE_WAVE_WAIT;
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_BLOCK = "Block";
static var sSTATE_BLOCK_1 = "Block1";
static var sSTATE_BLOCK_2 = "Block2";
}
Symbol 937 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.LevelInfo
{
var aCars;
function LevelInfo () {
aCars = new Array();
}
function destroy() {
var _local2 = aCars.length - 1;
for ( ; (_local2 >= 0) && (aCars.length != undefined) ; _local2--) {
com.disney.gem.games.mickeyFriendsTownRace.game.CarInfo(aCars[_local2]).destroy();
}
}
static var nRACE_TYPE_NORMAL = 1;
static var nRACE_TYPE_LAST_STANDING = 2;
}
Symbol 938 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.CarInfo] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.CarInfo
{
function CarInfo () {
}
function destroy() {
}
}
Symbol 939 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager
{
static var oInstance;
var oCollisionBitmap, oSlidingBitmap, nMapRatio;
function ReactionManager (_oCollisionBitmap, _oSlidingBitmap, _nMapRatio) {
oInstance = this;
oCollisionBitmap = _oCollisionBitmap;
oSlidingBitmap = _oSlidingBitmap;
nMapRatio = _nMapRatio;
}
function getSlidingInertiaMultiplicatorForPoint(_oPt) {
_oPt = _oPt.clone();
_oPt.x = _oPt.x * nMapRatio;
_oPt.y = _oPt.y * nMapRatio;
_oPt.x = Math.round(_oPt.x);
_oPt.y = Math.round(_oPt.y);
var _local3 = oSlidingBitmap.getPixel(_oPt.x, _oPt.y);
var _local4 = 1 - ((_local3 - nSLIDING_COLOR_MIN) / (nSLIDING_COLOR_MAX - nSLIDING_COLOR_MIN));
var _local5 = (_local4 * (nSLIDING_INERTIA_FACTOR_MAX - nSLIDING_INERTIA_FACTOR_MIN)) + nSLIDING_INERTIA_FACTOR_MIN;
return(_local5);
}
function getCollisionVectorNormalForPoint(_oOrigin, _oTarget) {
_oOrigin = _oOrigin.clone();
_oTarget = _oTarget.clone();
_oOrigin.x = _oOrigin.x * nMapRatio;
_oOrigin.y = _oOrigin.y * nMapRatio;
_oTarget.x = _oTarget.x * nMapRatio;
_oTarget.y = _oTarget.y * nMapRatio;
var _local4 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
var _local5 = new flash.geom.Rectangle();
_local5.x = Math.round(Math.min(_oOrigin.x, _oTarget.x));
_local5.y = Math.round(Math.min(_oOrigin.y, _oTarget.y));
_local5.width = Math.abs(Math.round(_oOrigin.subtract(_oTarget).x));
_local5.height = Math.abs(Math.round(_oOrigin.subtract(_oTarget).y));
_local5.inflate(nDETECT_PAD, nDETECT_PAD);
var _local6 = new flash.display.BitmapData(_local5.width, _local5.height, false, 0);
_local6.copyPixels(oCollisionBitmap, _local5, new flash.geom.Point(0, 0));
var _local7 = new Array();
var _local8 = Math.min(nCOLLISION_VECT_SEARCH_ACCURACY, _local6.width);
var _local9 = Math.min(nCOLLISION_VECT_SEARCH_ACCURACY, _local6.height);
var _local10 = _local6.getPixel(0, 0);
var _local11 = _local8;
for ( ; _local11 <= (_local6.width - 1) ; _local11 = _local11 + _local8) {
var _local12 = _local6.getPixel(_local11, 0);
if (_local12 != _local10) {
_local7.push(new flash.geom.Point(_local11, 0));
break;
}
_local10 = _local12;
}
_local10 = _local6.getPixel(0, _local6.height - 1);
var _local13 = _local8;
for ( ; _local13 <= (_local6.width - 1) ; _local13 = _local13 + _local8) {
var _local14 = _local6.getPixel(_local13, _local6.height - 1);
if (_local14 != _local10) {
_local7.push(new flash.geom.Point(_local13, _local6.height - 1));
break;
}
_local10 = _local14;
}
_local10 = _local6.getPixel(0, 0);
var _local15 = _local9;
for ( ; _local15 <= (_local6.height - 1) ; _local15 = _local15 + _local9) {
var _local16 = _local6.getPixel(0, _local15);
if (_local16 != _local10) {
_local7.push(new flash.geom.Point(0, _local15));
break;
}
_local10 = _local16;
}
_local10 = _local6.getPixel(_local6.width - 1, 0);
var _local17 = _local9;
for ( ; _local17 <= (_local6.height - 1) ; _local17 = _local17 + _local9) {
var _local18 = _local6.getPixel(_local6.width - 1, _local17);
if (_local18 != _local10) {
_local7.push(new flash.geom.Point(_local6.width - 1, _local17));
break;
}
_local10 = _local18;
}
var _local19 = _local7[0];
var _local20 = _local7[1];
if ((_local19 != undefined) && (_local20 != undefined)) {
var _local21 = _local19.subtract(_local20);
_local4.vx = _local21.x;
_local4.vy = _local21.y;
_local4 = _local4.perp();
var _local22 = _local6.getPixel(0, 0) == nCOLOR_WHITE;
var _local23 = _local6.getPixel(_local6.width - 1, 0) == nCOLOR_WHITE;
var _local24 = _local6.getPixel(0, _local6.height - 1) == nCOLOR_WHITE;
var _local25 = _local6.getPixel(_local6.width - 1, _local6.height - 1) == nCOLOR_WHITE;
var _local26 = com.sarbakan.utils.MoreMath.getPolarity(_local4.vx);
var _local27 = com.sarbakan.utils.MoreMath.getPolarity(_local4.vy);
if (_local26 == 0) {
if (_local27 == -1) {
if ((!_local22) || (!_local23)) {
_local4 = _local4.getReverse();
}
} else if (_local27 == 1) {
if ((!_local24) || (!_local25)) {
_local4 = _local4.getReverse();
}
}
} else if (_local27 == 0) {
if (_local26 == 1) {
if ((!_local23) || (!_local25)) {
_local4 = _local4.getReverse();
}
} else if (_local26 == -1) {
if ((!_local22) || (!_local24)) {
_local4 = _local4.getReverse();
}
}
} else if ((_local26 == 1) && (_local27 == 1)) {
if (!_local25) {
_local4 = _local4.getReverse();
}
} else if ((_local26 == -1) && (_local27 == -1)) {
if (!_local22) {
_local4 = _local4.getReverse();
}
} else if ((_local26 == 1) && (_local27 == -1)) {
if (!_local23) {
_local4 = _local4.getReverse();
}
} else if ((_local26 == -1) && (_local27 == 1)) {
if (!_local24) {
_local4 = _local4.getReverse();
}
}
} else {
var _local28 = _oOrigin.subtract(_oTarget);
_local4.vx = _local28.x;
_local4.vy = _local28.y;
if (_local4.length() < nMIN_REBOUND) {
_local4 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(_local4).mult(nMIN_REBOUND);
}
}
_local4.normalize();
_local6.dispose();
return(_local4);
}
function getZoneType(_oTestPoint) {
var _local3 = nZONE_TYPE_FREE;
_oTestPoint = _oTestPoint.clone();
_oTestPoint.x = _oTestPoint.x * nMapRatio;
_oTestPoint.y = _oTestPoint.y * nMapRatio;
_oTestPoint.x = Math.round(_oTestPoint.x);
_oTestPoint.y = Math.round(_oTestPoint.y);
var _local4 = oCollisionBitmap.getPixel(_oTestPoint.x, _oTestPoint.y);
if (_local4 == nCOLOR_BLACK) {
_local3 = nZONE_TYPE_COLLIDE;
} else {
_local4 = oSlidingBitmap.getPixel(_oTestPoint.x, _oTestPoint.y);
if (_local4 != nCOLOR_WHITE) {
_local3 = nZONE_TYPE_SLIDING;
}
}
return(_local3);
}
function destroy() {
delete oInstance;
oCollisionBitmap.dispose();
delete oCollisionBitmap;
oSlidingBitmap.dispose();
delete oSlidingBitmap;
}
static var nCOLOR_BLACK = 0;
static var nCOLOR_WHITE = 16777215;
static var nZONE_TYPE_FREE = 1;
static var nZONE_TYPE_COLLIDE = 2;
static var nZONE_TYPE_SLIDING = 3;
static var nCOLLISION_VECT_SEARCH_ACCURACY = 3;
static var nDETECT_PAD = 70;
static var nMIN_REBOUND = 6;
static var nSLIDING_INERTIA_FACTOR_MIN = 1;
static var nSLIDING_INERTIA_FACTOR_MAX = 10;
static var nSLIDING_COLOR_MAX = nCOLOR_WHITE;
static var nSLIDING_COLOR_MIN = nCOLOR_BLACK;
}
Symbol 940 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.map.RaceCamera] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.map.RaceCamera
{
var mcZone, oConstraint, bStartMove, oStartPoint, oCamPos, oTargetCamPos, fOnInitialMoveComplete, oTarget, oCamTweenX, oCamTweenY;
function RaceCamera (_mcZone, _oConstraint, _oStartPoint, _fOnInitialMoveComplete) {
mcZone = _mcZone;
oConstraint = _oConstraint;
bStartMove = true;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
oStartPoint = _oStartPoint.clone();
oCamPos = oStartPoint.clone();
oTargetCamPos = oCamPos.clone();
moveCameraTo(oTargetCamPos);
fOnInitialMoveComplete = _fOnInitialMoveComplete;
}
function onUpdate() {
if (oTarget != undefined) {
makeMove();
}
}
function setTarget(_oCar) {
oTarget = _oCar;
moveCameraTo(oTarget.oCameraTargetPosition);
oCamTweenX = new mx.transitions.Tween(oTargetCamPos, "x", mx.transitions.easing.Regular.easeInOut, oStartPoint.x, oTarget.oCameraTargetPosition.x, nSTART_TWEEN_DURATION, false);
oCamTweenY = new mx.transitions.Tween(oTargetCamPos, "y", mx.transitions.easing.Regular.easeInOut, oStartPoint.y, oTarget.oCameraTargetPosition.y, nSTART_TWEEN_DURATION, false);
oCamTweenX.onMotionFinished = com.sarbakan.utils.Delegate.create(this, onTweenMotionComplete, oCamTweenX);
oCamTweenY.onMotionFinished = com.sarbakan.utils.Delegate.create(this, onTweenMotionComplete, oCamTweenY);
oCamTweenX.stop();
oCamTweenY.stop();
}
function onTweenMotionComplete(_oTween) {
delete _oTween.onMotionFinished;
if ((oCamTweenX.onMotionFinished == undefined) && (oCamTweenY.onMotionFinished == undefined)) {
fOnInitialMoveComplete();
delete fOnInitialMoveComplete;
bStartMove = false;
}
}
function destroy() {
delete mcZone;
delete oConstraint;
delete oTarget;
delete oStartPoint;
delete oCamPos;
delete oTargetCamPos;
delete oCamTweenX;
delete oCamTweenY;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
}
function makeMove() {
if (!bStartMove) {
oCamTweenX.continueTo(oTarget.oCameraTargetPosition.x, nTWEEN_DURATION);
oCamTweenY.continueTo(oTarget.oCameraTargetPosition.y, nTWEEN_DURATION);
}
oCamTweenX.nextFrame();
oCamTweenY.nextFrame();
moveCameraTo(oTargetCamPos);
}
function moveCameraTo(_oTarget) {
oCamPos.x = -(_oTarget.x - nBUFFER_X);
oCamPos.y = -(_oTarget.y - nBUFFER_Y);
validatePosition();
mcZone._x = oCamPos.x;
mcZone._y = oCamPos.y;
}
function validatePosition() {
oCamPos.x = Math.min(-oConstraint.left, oCamPos.x);
oCamPos.y = Math.min(-oConstraint.top, oCamPos.y);
oCamPos.x = Math.max(-(oConstraint.right - com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.nVIEWPORT_WIDTH), oCamPos.x);
oCamPos.y = Math.max(-(oConstraint.bottom - com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.nVIEWPORT_HEIGHT), oCamPos.y);
}
static var nBUFFER_X = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.nVIEWPORT_WIDTH / 2;
static var nBUFFER_Y = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.nVIEWPORT_HEIGHT / 2;
static var nTWEEN_DURATION = 4;
static var nSTART_TWEEN_DURATION = 85;
}
Symbol 941 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.CarBase] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.CarBase extends com.sarbakan.utils.StateManaged
{
var mcRef, oPointRearLeft, oPointRearRight, oPointFrontLeft, oPointFrontRight, oCoord, oInertiaVector, oLatestMoveVector, oCarRealRotationVector, nSpeedBoostAvailable, nInvincibleDuration, nFullThrottleDuration, nSpeed, nCarHealth, nCarStamina, nLapsCompleted, bRaceEnded, bDead, oRouteNodeCurrent, oRouteNodeNext, setState, oCarType, nFinalPosition, nRank, sState, oCameraTargetPosition, stateFinished, nCarID;
function CarBase (_mcRef) {
super(_mcRef);
mcRef.mcHitRearLeft.gotoAndStop(2);
mcRef.mcHitRearRight.gotoAndStop(2);
mcRef.mcHitFrontLeft.gotoAndStop(2);
mcRef.mcHitFrontRight.gotoAndStop(2);
mcRef.mcHitRearLeft._visible = false;
mcRef.mcHitRearRight._visible = false;
mcRef.mcHitFrontLeft._visible = false;
mcRef.mcHitFrontRight._visible = false;
oPointRearLeft = new flash.geom.Point(mcRef.mcHitRearLeft._x, mcRef.mcHitRearLeft._y);
oPointRearRight = new flash.geom.Point(mcRef.mcHitRearRight._x, mcRef.mcHitRearRight._y);
oPointFrontLeft = new flash.geom.Point(mcRef.mcHitFrontLeft._x, mcRef.mcHitFrontLeft._y);
oPointFrontRight = new flash.geom.Point(mcRef.mcHitFrontRight._x, mcRef.mcHitFrontRight._y);
oCoord = new flash.geom.Point();
oCoord.x = mcRef._x;
oCoord.y = mcRef._y;
updateCameraPos();
oInertiaVector = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
oLatestMoveVector = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
oCarRealRotationVector = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
nSpeedBoostAvailable = nSPEED_BOOST_AT_START;
nInvincibleDuration = 0;
nFullThrottleDuration = 0;
nSpeed = 0;
nCarHealth = nBASE_HEALTH;
nCarStamina = nBASE_STAMINA;
nLapsCompleted = 0;
bRaceEnded = false;
bDead = false;
var _local4 = com.sarbakan.utils.MoreMath.getRadianFromDegree(mcRef._rotation);
oCarRealRotationVector.vx = Math.cos(_local4);
oCarRealRotationVector.vy = Math.sin(_local4);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
oRouteNodeCurrent = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().oStartLineRouteNode;
oRouteNodeNext = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getRouteNodeNum(oRouteNodeCurrent.nNum + 1);
setState(sSTATE_IDLE, true);
}
function instantDeath() {
onHit(nCarHealth * 2);
}
function setCarType(_oCarType) {
oCarType = _oCarType;
nCarHealth = nBASE_HEALTH * oCarType.oCarStats.nStamina;
nCarStamina = nBASE_STAMINA * oCarType.oCarStats.nStamina;
}
function onUpdate() {
super.onUpdate();
nInvincibleDuration--;
nFullThrottleDuration--;
if (bRaceEnded) {
forcedBrakes();
goStraight();
}
steerCar();
moveCar();
checkOpponents();
checkObstacles();
checkAttacks();
updateCarRouteNodes();
updateCameraPos();
checkBonuses();
}
function accelerate() {
if (!bRaceEnded) {
nSpeed = nSpeed + getAcceleration();
if (nSpeed > getMaxSpeed()) {
nSpeed = getMaxSpeed();
}
}
}
function cruise() {
if (!bRaceEnded) {
nSpeed = nSpeed - nCRUISE_FRICTION;
if (nSpeed < 0) {
nSpeed = 0;
}
}
}
function applyBreak() {
if (!bRaceEnded) {
forcedBrakes();
}
}
function goStraight() {
if (!bRaceEnded) {
if (oInertiaVector.length() > 1) {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oInertiaVector);
oCarRealRotationVector = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCarRealRotationVector);
if (nSpeed < 0) {
_local2 = _local2.getReverse();
}
var _local3 = getSteerReleaseHitData();
oCarRealRotationVector = applyVectorRatios(_local2, oCarRealRotationVector, _local3.nTarget, _local3.nCurrent);
}
}
}
function turnLeft() {
if (!bRaceEnded) {
oCarRealRotationVector = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.RotateAroundOrigin(oCarRealRotationVector, com.sarbakan.utils.MoreMath.getRadianFromDegree(-getCarRotate()));
}
}
function turnRight() {
if (!bRaceEnded) {
oCarRealRotationVector = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.RotateAroundOrigin(oCarRealRotationVector, com.sarbakan.utils.MoreMath.getRadianFromDegree(getCarRotate()));
}
}
function getCurrentNodeNum() {
return(oRouteNodeCurrent.nNum);
}
function getDistanceFromTargetNode() {
return(oRouteNodeNext.oCoord.subtract(oCoord).length);
}
function stopMoveRaceEnd() {
bRaceEnded = true;
}
function calculatePosition() {
if (nFinalPosition == undefined) {
nRank = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getPositionForCar(this);
} else {
nRank = nFinalPosition;
}
}
function affectCollisionFromPointToMoveWithCar(_oCollisionPoint, _oCollidedCar) {
var _local4 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(oCoord.subtract(_oCollisionPoint));
var _local5 = _oCollidedCar.getLastMove().add(getLastMove()).div(2);
if (_local5.isZero()) {
_local5 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(_local4);
_local4.add(_local5).div(2);
}
_local4.normalize();
_local4 = _local4.mult(_local5.length()).mult(0.75);
oCoord.x = oCoord.x + _local4.vx;
oCoord.y = oCoord.y + _local4.vy;
oInertiaVector = oInertiaVector.add(_local4);
oCarRealRotationVector = applyVectorRatios(com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCarRealRotationVector), com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(_local4), 25, 1);
var _local6 = com.sarbakan.utils.Delegate.create(com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance(), com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castRacerCollisionSound, oCoord);
onHit(nHEALTH_LOSS_CAR, _local6);
}
function launchAttack() {
if ((sState != sSTATE_DYING) && ((sState != sSTATE_DEAD) && (!bRaceEnded))) {
if (nCarStamina >= nSTAMINA_USE_ATTACK) {
nCarStamina = nCarStamina - nSTAMINA_USE_ATTACK;
setState(sSTATE_SHOOT, true);
var _local2 = oCoord.clone();
var _local3 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCarRealRotationVector).mult(nATTACK_START_DISTANCE);
_local2 = _local2.add(com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.VectorToPoint(_local3));
var _local4 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getAttachedAttack(oCarType.sAttackLinkage);
_local4._x = _local2.x;
_local4._y = _local2.y;
_local4._rotation = mcRef._rotation;
var _local5 = new com.disney.gem.games.mickeyFriendsTownRace.game.Attack(_local4, getSpeed());
_local5.nAttackType = oCarType.nCarType;
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castAttackSound(oCarType.nCarType, _local2);
return(true);
}
return(false);
}
return(false);
}
function activateBoost() {
if ((sState != sSTATE_DYING) && ((sState != sSTATE_DEAD) && (!bRaceEnded))) {
if ((nSpeedBoostAvailable > 0) && (nFullThrottleDuration <= 0)) {
nSpeedBoostAvailable--;
setState(sSTATE_FULLTHROTTLE, true);
nFullThrottleDuration = nFULLTHROTTLE_DURATION;
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castBoostSound(oCoord);
return(true);
}
return(false);
}
}
function getRef() {
return(mcRef);
}
function getFacing() {
return(oCarRealRotationVector);
}
function getLastMove() {
return(oLatestMoveVector);
}
function getSpeedMax() {
return(getMaxSpeed());
}
function getSpeed() {
return(oLatestMoveVector.length());
}
function onHit(_nLoss, _oSoundFunction) {
if ((sState != sSTATE_DYING) && ((sState != sSTATE_DEAD) && (nInvincibleDuration <= 0))) {
setState(sSTATE_HIT, true);
nCarHealth = nCarHealth - _nLoss;
_oSoundFunction();
nInvincibleDuration = nINVINCIBILITY_DURATION;
if ((nCarHealth <= 0) && (!bRaceEnded)) {
setState(sSTATE_DYING, true);
bRaceEnded = true;
bDead = true;
if (nFinalPosition == undefined) {
nFinalPosition = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().onCarDeadGetRank();
}
}
}
}
function getStaminaPercentage() {
return(nCarStamina / (nBASE_STAMINA * oCarType.oCarStats.nStamina));
}
function getHealthPercentage() {
return(nCarHealth / (nBASE_HEALTH * oCarType.oCarStats.nStamina));
}
function destroy() {
super.destroy();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
delete oCoord;
delete oCameraTargetPosition;
delete oCarRealRotationVector;
delete oInertiaVector;
delete oLatestMoveVector;
oCarType.destroy();
delete oCarType;
onUpdate = new Function();
}
function toString() {
return("[CarBase]");
}
function state_Shoot() {
if (stateFinished()) {
setState(sSTATE_IDLE, true);
}
}
function state_Dying() {
if (stateFinished()) {
setState(sSTATE_DEAD, true);
}
}
function state_FullThrottle() {
if (stateFinished()) {
setState(sSTATE_IDLE, true);
}
}
function state_Hit() {
if (stateFinished()) {
setState(sSTATE_IDLE, true);
}
}
function forcedBrakes() {
nSpeed = nSpeed - getBreaking();
if (nSpeed < nDEFAULT_MAX_BACK_UP_SPEED) {
nSpeed = nDEFAULT_MAX_BACK_UP_SPEED;
}
}
function steerCar() {
mcRef._rotation = com.sarbakan.utils.MoreMath.getDegreeFromRadius(Math.atan2(oCarRealRotationVector.vy, oCarRealRotationVector.vx));
}
function moveCar() {
var _local2 = oCarRealRotationVector.mult(nSpeed);
var _local3 = getMoveInertiaData();
oLatestMoveVector = applyVectorRatios(_local2, oInertiaVector, _local3.nTarget, _local3.nInertia);
var _local4 = new flash.geom.Point(oCoord.x + oLatestMoveVector.vx, oCoord.y + oLatestMoveVector.vy);
var _local5 = oPointFrontLeft.clone();
var _local6 = oPointFrontRight.clone();
var _local7 = oPointRearLeft.clone();
var _local8 = oPointRearRight.clone();
mcRef.localToGlobal(_local5);
mcRef.localToGlobal(_local6);
mcRef.localToGlobal(_local7);
mcRef.localToGlobal(_local8);
mcRef._parent.globalToLocal(_local5);
mcRef._parent.globalToLocal(_local6);
mcRef._parent.globalToLocal(_local7);
mcRef._parent.globalToLocal(_local8);
var _local9 = com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getZoneType(_local5);
var _local10 = com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getZoneType(_local6);
var _local11 = com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getZoneType(_local7);
var _local12 = com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getZoneType(_local8);
if ((_local9 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_FREE) && ((_local10 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_FREE) && ((_local11 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_FREE) && (_local12 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_FREE)))) {
oCoord = _local4.clone();
} else if ((_local9 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE) || ((_local10 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE) || ((_local11 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE) || (_local12 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE)))) {
var _local13 = _local4;
var _local14 = oCoord;
var _local15 = com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getCollisionVectorNormalForPoint(_local14, _local13);
oLatestMoveVector = oLatestMoveVector.reflect(_local15);
if ((_local11 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE) || (_local12 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE)) {
var _local16 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oLatestMoveVector).add(_local15).div(2);
var _local17 = Math.max(oLatestMoveVector.length(), nBOUNCE_MINIMUM_SPEED);
oLatestMoveVector = _local16.mult(_local17);
}
oLatestMoveVector = oLatestMoveVector.mult(nBOUNCE_SPEED_RATIO);
if (oLatestMoveVector.length() < nBOUNCE_MINIMUM_SPEED) {
oLatestMoveVector = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(_local15).mult(nBOUNCE_MINIMUM_SPEED);
}
var _local18 = new flash.geom.Point(oCoord.x + oLatestMoveVector.vx, oCoord.y + oLatestMoveVector.vy);
oCoord = _local18.clone();
var _local19 = com.sarbakan.utils.Delegate.create(com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance(), com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castWallCollisionSound, oCoord);
onHit(nHEALTH_LOSS_REGULAR, _local19);
} else if ((_local9 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_SLIDING) || ((_local10 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_SLIDING) || ((_local11 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_SLIDING) || (_local12 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_SLIDING)))) {
oLatestMoveVector = applyVectorRatios(_local2, oInertiaVector, _local3.nTarget, Math.round(_local3.nInertia * com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getSlidingInertiaMultiplicatorForPoint(_local4)));
_local4 = new flash.geom.Point(oCoord.x + oLatestMoveVector.vx, oCoord.y + oLatestMoveVector.vy);
oCoord = _local4.clone();
}
mcRef._x = oCoord.x;
mcRef._y = oCoord.y;
if (oLatestMoveVector.length() < 0.1) {
oLatestMoveVector.zero();
}
oInertiaVector = oLatestMoveVector.copy();
}
function checkBonuses() {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getAllBonuses();
var _local3 = _local2.length - 1;
for ( ; (_local3 >= 0) && (_local2.length != undefined) ; _local3--) {
var _local4 = _local2[_local3];
if (_local4.isAvailable()) {
if (_local4.oCoord.subtract(oCoord).length < nBONUS_CATCH_DIST) {
_local4.onCatched();
affectBonus(_local4);
}
}
}
}
function affectBonus(_oBonus) {
switch (_oBonus.nType) {
case com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_REPAIR :
nCarHealth = nCarHealth + nHEALTH_REGAIN_BONUS;
nCarHealth = Math.min(nCarHealth, nBASE_HEALTH * oCarType.oCarStats.nStamina);
if (this == com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "Bonus_Repair.wav");
}
break;
case com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_SPEED :
nSpeedBoostAvailable++;
if (this == com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "Bonus_Speed_Boost.wav");
}
break;
case com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_TOON :
nCarStamina = nCarStamina + nHEALTH_REGAIN_BONUS;
nCarStamina = Math.min(nCarStamina, nBASE_STAMINA * oCarType.oCarStats.nStamina);
if (this == com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "Bonus_Toon_Token.wav");
}
break;
case com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_POINTS_2K :
if (this == com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar) {
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().nPointsBonuses = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().nPointsBonuses + 2000;
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "Bonus_Point_Small.wav");
}
break;
case com.disney.gem.games.mickeyFriendsTownRace.game.Bonus.nTYPE_POINTS_5K :
if (this != com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar) {
break;
}
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().nPointsBonuses = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().nPointsBonuses + 5000;
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "Bonus_Point_Big.wav");
}
}
function checkAttacks() {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getAllAttacks();
var _local3 = _local2.length - 1;
for ( ; (_local3 >= 0) && (_local2.length != undefined) ; _local3--) {
var _local4 = _local2[_local3];
if (_local4.nAttackType != oCarType.nCarType) {
if (Math.abs(oCoord.subtract(_local4.oCoord).length) <= 100) {
checkPreciseAttack(_local4);
}
}
}
}
function checkPreciseAttack(_oAttack) {
var _local3 = oPointRearLeft.clone();
var _local4 = oPointRearRight.clone();
var _local5 = oPointFrontLeft.clone();
var _local6 = oPointFrontRight.clone();
var _local7 = _oAttack.oCoord.clone();
mcRef.localToGlobal(_local3);
mcRef.localToGlobal(_local4);
mcRef.localToGlobal(_local5);
mcRef.localToGlobal(_local6);
_oAttack.Mc._parent.localToGlobal(_local7);
mcRef._parent.globalToLocal(_local3);
mcRef._parent.globalToLocal(_local4);
mcRef._parent.globalToLocal(_local5);
mcRef._parent.globalToLocal(_local6);
mcRef._parent.globalToLocal(_local7);
var _local8 = new flash.geom.Rectangle();
var _local9 = new flash.geom.Rectangle();
_local8.topLeft = _local6;
_local8.bottomRight = _local3;
_local9.topLeft = _local5;
_local9.bottomRight = _local4;
var _local10 = _local8.union(_local9);
if (_local10.width < 0) {
_local10.x = _local10.x + _local10.width;
_local10.width = Math.abs(_local10.width);
}
if (_local10.height < 0) {
_local10.y = _local10.y + _local10.height;
_local10.height = Math.abs(_local10.height);
}
_local10.inflate(10, 10);
var _local11 = _local10.containsPoint(_local7);
if (_local11) {
affectCollisionFromPointToMoveWithAttack(_oAttack.oCoord, _oAttack.nAttackType);
_oAttack.onHit();
if (_oAttack.nAttackType == com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman.oInstance.oCar.oCarType.nCarType) {
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().nPointsDamage = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().nPointsDamage + 100;
}
}
}
function affectCollisionFromPointToMoveWithAttack(_oAttackPoint, _nAttackType) {
var _local4 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(_oAttackPoint.subtract(oCoord));
_local4.normalize();
oLatestMoveVector = oLatestMoveVector.reflect(_local4);
var _local5 = new flash.geom.Point(oCoord.x + oLatestMoveVector.vx, oCoord.y + oLatestMoveVector.vy);
oCoord = _local5.clone();
oInertiaVector = oLatestMoveVector.copy();
var _local6 = com.sarbakan.utils.Delegate.create(com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance(), com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castAttackHitSound, _nAttackType, oCoord);
onHit(nHEALTH_LOSS_WEAPON, _local6);
}
function checkObstacles() {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getAllObstacles();
var _local3 = _local2.length - 1;
for ( ; (_local3 >= 0) && (_local2.length != undefined) ; _local3--) {
var _local4 = _local2[_local3];
if (_local4.oCoord.subtract(oCoord).length < _local4.nRadius) {
affectCollisionFromPointToMoveWithObstacle(_local4.oCoord);
}
}
var _local5 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().oSpecialObstacle;
if (_local5.isActive()) {
var _local6 = oPointRearLeft.clone();
var _local7 = oPointRearRight.clone();
var _local8 = oPointFrontLeft.clone();
var _local9 = oPointFrontRight.clone();
var _local10 = _local5.Mc;
var _local11 = new Array(_local8, _local9, _local6, _local7);
var _local12 = 0;
for ( ; _local12 <= (_local11.length - 1) ; _local12++) {
var _local13 = _local11[_local12];
mcRef.localToGlobal(_local13);
if (_local10.hitTest(_local13.x, _local13.y, true)) {
var _local14 = com.sarbakan.utils.MoreMath.getBoundsCenter(_local10.getBounds(mcRef._parent));
var _local15 = new flash.geom.Point(_local14.x, _local14.y);
affectCollisionFromPointToMoveWithSpecialObstacle(_local15);
}
}
}
}
function affectCollisionFromPointToMoveWithSpecialObstacle(_oObstaclePoint) {
var _local3 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(_oObstaclePoint.subtract(oCoord));
_local3.normalize();
if (_local3.angl(oLatestMoveVector, true) < 135) {
oLatestMoveVector = oLatestMoveVector.reflect(_local3);
if (oLatestMoveVector.length() < nSPECIAL_OBSTACLE_MIN_REBOUND) {
oLatestMoveVector.normalize();
oLatestMoveVector.mult(nSPECIAL_OBSTACLE_MIN_REBOUND);
}
var _local4 = new flash.geom.Point(oCoord.x + oLatestMoveVector.vx, oCoord.y + oLatestMoveVector.vy);
oCoord = _local4.clone();
oInertiaVector = oLatestMoveVector.copy();
var _local5 = com.sarbakan.utils.Delegate.create(com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance(), com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castWallCollisionSound, oCoord);
onHit(nHEALTH_LOSS_SPECIAL, _local5);
}
}
function affectCollisionFromPointToMoveWithObstacle(_oObstaclePoint) {
var _local3 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(_oObstaclePoint.subtract(oCoord));
_local3.normalize();
if (_local3.angl(oLatestMoveVector, true) < 90) {
oLatestMoveVector = oLatestMoveVector.reflect(_local3).mult(nBOUNCE_SPEED_RATIO);
var _local4 = new flash.geom.Point(oCoord.x + oLatestMoveVector.vx, oCoord.y + oLatestMoveVector.vy);
oCoord = _local4.clone();
oInertiaVector = oLatestMoveVector.copy();
var _local5 = com.sarbakan.utils.Delegate.create(com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance(), com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().castWallCollisionSound, oCoord);
onHit(nHEALTH_LOSS_REGULAR, _local5);
}
}
function checkOpponents() {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getAllCars();
var _local3 = _local2.length - 1;
for ( ; (_local3 >= 0) && (_local2.length != undefined) ; _local3--) {
var _local4 = _local2[_local3];
if (_local4.nCarID < nCarID) {
if (_local4.oCoord.subtract(oCoord).length < nCAR_COLLISION_CHECK_DIST) {
checkOpponentCar(_local4);
}
}
}
}
function checkOpponentCar(_oOpponent) {
var _local3 = oPointRearLeft.clone();
var _local4 = oPointRearRight.clone();
var _local5 = oPointFrontLeft.clone();
var _local6 = oPointFrontRight.clone();
mcRef.localToGlobal(_local3);
mcRef.localToGlobal(_local4);
mcRef.localToGlobal(_local5);
mcRef.localToGlobal(_local6);
mcRef._parent.globalToLocal(_local3);
mcRef._parent.globalToLocal(_local4);
mcRef._parent.globalToLocal(_local5);
mcRef._parent.globalToLocal(_local6);
var _local7 = _oOpponent.getRef();
var _local8 = _oOpponent.oPointRearLeft.clone();
var _local9 = _oOpponent.oPointRearRight.clone();
var _local10 = _oOpponent.oPointFrontLeft.clone();
var _local11 = _oOpponent.oPointFrontRight.clone();
_local7.localToGlobal(_local8);
_local7.localToGlobal(_local9);
_local7.localToGlobal(_local10);
_local7.localToGlobal(_local11);
_local7._parent.globalToLocal(_local8);
_local7._parent.globalToLocal(_local9);
_local7._parent.globalToLocal(_local10);
_local7._parent.globalToLocal(_local11);
var _local12 = {oPt1:_local3, oPt2:_local4, oPt3:_local5, oPt4:_local6};
var _local13 = {oPt1:_local8, oPt2:_local9, oPt3:_local10, oPt4:_local11};
var _local16 = true;
var _local14 = 1;
for ( ; (_local14 <= 4) && (_local16) ; _local14++) {
var _local17 = _local12["oPt" + _local14];
var _local18 = _local14 + 1;
if (_local18 > 4) {
_local18 = 1;
}
var _local19 = _local12["oPt" + _local18];
var _local15 = 1;
for ( ; (_local15 <= 4) && (_local16) ; _local15++) {
var _local20 = _local13["oPt" + _local15];
var _local21 = _local15 + 1;
if (_local21 > 4) {
_local21 = 1;
}
var _local22 = _local13["oPt" + _local21];
var _local23 = getIntersectionPoint(_local17, _local19, _local20, _local22);
if (_local23 != null) {
affectCollisionFromPointToMoveWithCar(_local23, _oOpponent);
_oOpponent.affectCollisionFromPointToMoveWithCar(_local23, this);
_local16 = false;
}
}
}
}
function getStandardLinearEquation(_oPointA, _oPointB) {
var _local4 = new Object();
_local4.x = 0;
if (_oPointA.y == _oPointB.y) {
_local4.a = 0;
_local4.b = _oPointA.y;
} else {
var _local5 = 0;
if (_oPointA.x == _oPointB.x) {
_local4.a = 0;
_local4.b = 0;
_local4.x = _oPointA.x;
} else {
if (_oPointA.x <= _oPointB.x) {
var _local6 = _oPointA;
var _local7 = _oPointB;
} else {
var _local6 = _oPointB;
var _local7 = _oPointA;
}
_local4.a = (_local7.y - _local6.y) / ((_local7.x + _local5) - _local6.x);
_local4.b = _local7.y - (_local4.a * _local7.x);
}
}
return(_local4);
}
function getIntersectionPoint(_oPointA1, _oPointA2, _oPointB1, _oPointB2) {
var _local6 = getStandardLinearEquation(_oPointA1, _oPointA2);
var _local7 = getStandardLinearEquation(_oPointB1, _oPointB2);
if ((_local6.x != 0) || (_local7.x != 0)) {
if (_local6.x == _local7.x) {
var _local9 = Math.min(_oPointA1.y, _oPointA2.y);
_local9 = Math.min(_local9, _oPointB1.y);
_local9 = Math.min(_local9, _oPointB2.y);
if (_local9 == _oPointA1.y) {
var _local8 = _oPointA2.clone();
} else if (_local9 == _oPointA2.y) {
var _local8 = _oPointA1.clone();
} else if (_local9 == _oPointB1.y) {
var _local8 = _oPointB2.clone();
} else {
var _local8 = _oPointB1.clone();
}
} else if (_local6.x != 0) {
var _local8 = new flash.geom.Point();
_local8.x = _local6.x;
_local8.y = (_local7.a * _local8.x) + _local7.b;
if (floatEquals(_local8.y, _oPointB1.y)) {
_local8.y = _oPointB1.y;
} else if (floatEquals(_local8.y, _oPointB2.y)) {
_local8.y = _oPointB2.y;
}
} else {
var _local8 = new flash.geom.Point();
_local8.x = _local7.x;
_local8.y = (_local6.a * _local8.x) + _local6.b;
if (floatEquals(_local8.y, _oPointA1.y)) {
_local8.y = _oPointB1.y;
} else if (floatEquals(_local8.y, _oPointA2.y)) {
_local8.y = _oPointB2.y;
}
}
if (((_local8 != null) && ((_local8.y < _oPointA1.y) && (_local8.y < _oPointA2.y))) || (((_local8.y > _oPointA1.y) && (_local8.y > _oPointA2.y)) || (((_local8.y < _oPointB1.y) && (_local8.y < _oPointB2.y)) || ((_local8.y > _oPointB1.y) && (_local8.y > _oPointB2.y))))) {
var _local8 = null;
}
} else if (_local6.a == _local7.a) {
if (_local6.b != _local7.b) {
var _local8 = null;
} else {
var _local8 = _oPointA1.clone();
}
} else {
var _local8 = new flash.geom.Point();
_local8.x = (_local6.b - _local7.b) / (_local7.a - _local6.a);
_local8.y = (_local6.a * _local8.x) + _local6.b;
if (((_local8.x < _oPointA1.x) && (_local8.x < _oPointA2.x)) || (((_local8.x > _oPointA1.x) && (_local8.x > _oPointA2.x)) || (((_local8.x < _oPointB1.x) && (_local8.x < _oPointB2.x)) || ((_local8.x > _oPointB1.x) && (_local8.x > _oPointB2.x))))) {
_local8 = null;
}
}
return(_local8);
}
function floatEquals(_n1, _n2) {
return(Math.abs(_n1 - _n2) < 0.001);
}
function getSteerReleaseHitData() {
var _local2 = {};
if (oLatestMoveVector.length() < 0) {
var _local3 = 0;
} else {
var _local3 = oLatestMoveVector.length() / getMaxSpeed();
}
if (oLatestMoveVector.length() > nSTEER_RELEASE_HIT_RATIO_MIN_SPEED) {
_local2.nTarget = Math.round(_local3 * 100);
_local2.nTarget = Math.max(nSTEER_RELEASE_HIT_RATIO_MIN, _local2.nTarget);
_local2.nTarget = Math.min(nSTEER_RELEASE_HIT_RATIO_MAX, _local2.nTarget);
} else {
_local2.nTarget = nSTEER_RELEASE_HIT_RATIO_MIN;
}
_local2.nCurrent = 100 - _local2.nTarget;
return(_local2);
}
function getMoveInertiaData() {
var _local2 = {};
_local2.nInertia = Math.ceil(nINERTIA_RATIOS_BASE_INERTIA * (1 / oCarType.oCarStats.nRoadHandling));
_local2.nTarget = Math.ceil(nINERTIA_RATIOS_BASE_TARGET * oCarType.oCarStats.nRoadHandling);
return(_local2);
}
function getMaxSpeed() {
var _local2 = nDEFAULT_MAX_SPEED * oCarType.oCarStats.nMaxSpeed;
if (nFullThrottleDuration > 0) {
_local2 = _local2 * nFULLTHROTTLE_MULT;
}
return(_local2);
}
function getAcceleration() {
var _local2 = nDEFAULT_ACCELERATION * oCarType.oCarStats.nAcceleration;
if (nFullThrottleDuration > 0) {
_local2 = _local2 * nFULLTHROTTLE_MULT;
}
return(_local2);
}
function getBreaking() {
return(nDEFAULT_BRAKING * oCarType.oCarStats.nRoadHandling);
}
function getCarRotate() {
var _local3 = oCarType.oCarStats.nRoadHandling;
if (nSpeed < 0) {
var _local4 = (oLatestMoveVector.length() * _local3) / nDEFAULT_MAX_BACK_UP_SPEED;
} else {
var _local4 = (oLatestMoveVector.length() * _local3) / getMaxSpeed();
}
var _local4 = Math.max(_local4, 0);
_local4 = Math.min(_local4, 1);
var _local2 = nCAR_ROTATE_MIN + (_local4 * (nCAR_ROTATE_MAX - nCAR_ROTATE_MIN));
return(_local2);
}
function applyVectorRatios(_oVec1, _oVec2, _nRate1, _nRate2) {
var _local6 = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
var _local7 = 1;
for ( ; _local7 <= _nRate1 ; _local7++) {
_local6 = _local6.add(_oVec1);
}
var _local8 = 1;
for ( ; _local8 <= _nRate2 ; _local8++) {
_local6 = _local6.add(_oVec2);
}
_local6 = _local6.div(_nRate1 + _nRate2);
return(_local6);
}
function updateCameraPos() {
oCameraTargetPosition = oCoord.clone();
oCameraTargetPosition.x = oCameraTargetPosition.x + (com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCarRealRotationVector).vx * nCAMERA_TARGET_LENGTH);
oCameraTargetPosition.y = oCameraTargetPosition.y + (com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCarRealRotationVector).vy * nCAMERA_TARGET_LENGTH);
}
function updateCarRouteNodes() {
if (oRouteNodeNext.oCoord.subtract(oCoord).length <= com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nACQUIRE_DISTANCE) {
if (oRouteNodeCurrent.nType == com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nTYPE_START_LINE) {
if (nLapsCompleted > com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getLapsQty()) {
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().onCarCompleteRace(this);
}
}
oRouteNodeCurrent = oRouteNodeNext;
oRouteNodeNext = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getRouteNodeNum(oRouteNodeCurrent.nNum + 1);
if (oRouteNodeCurrent.nType == com.disney.gem.games.mickeyFriendsTownRace.game.map.RouteNode.nTYPE_START_LINE) {
nLapsCompleted++;
}
}
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_FULLTHROTTLE = "FullThrottle";
static var sSTATE_HIT = "Hit";
static var sSTATE_SHOOT = "Shoot";
static var sSTATE_DYING = "Dying";
static var sSTATE_DEAD = "Dead";
static var nCAMERA_TARGET_LENGTH = com.disney.gem.games.mickeyFriendsTownRace.GameData.nCAMERA_POINT_LENGTH_IN_FRONT;
static var nBASE_HEALTH = 100;
static var nBASE_STAMINA = 100;
static var nSTAMINA_USE_ATTACK = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSTAMINA_USE_FOR_SINGLE_ATTACK;
static var nATTACK_START_DISTANCE = 55;
static var nHEALTH_LOSS_REGULAR = com.disney.gem.games.mickeyFriendsTownRace.GameData.nHEALTH_LOSS_REGULAR;
static var nHEALTH_LOSS_SPECIAL = com.disney.gem.games.mickeyFriendsTownRace.GameData.nHEALTH_LOSS_SPECIAL;
static var nHEALTH_LOSS_CAR = com.disney.gem.games.mickeyFriendsTownRace.GameData.nHEALTH_LOSS_CAR;
static var nHEALTH_LOSS_WEAPON = com.disney.gem.games.mickeyFriendsTownRace.GameData.nHEALTH_LOSS_WEAPON;
static var nHEALTH_REGAIN_BONUS = com.disney.gem.games.mickeyFriendsTownRace.GameData.nHEALTH_REGAIN_BONUS;
static var nSTAMINA_REGAIN_BONUS = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSTAMINA_REGAIN_BONUS;
static var nINERTIA_RATIOS_BASE_INERTIA = 10;
static var nINERTIA_RATIOS_BASE_TARGET = 1;
static var nSTEER_RELEASE_HIT_RATIO_MIN_SPEED = 3;
static var nSTEER_RELEASE_HIT_RATIO_MIN = 1;
static var nSTEER_RELEASE_HIT_RATIO_MAX = 15;
static var nCAR_ROTATE_MIN = 4;
static var nCAR_ROTATE_MAX = 7;
static var nBOUNCE_SPEED_RATIO = 0.5;
static var nBOUNCE_MINIMUM_SPEED = 0.5;
static var nSPECIAL_OBSTACLE_MIN_REBOUND = 4;
static var nCRUISE_FRICTION = com.disney.gem.games.mickeyFriendsTownRace.GameData.nCRUISE_FRICTION;
static var nDEFAULT_ACCELERATION = com.disney.gem.games.mickeyFriendsTownRace.GameData.nDEFAULT_ACCELERATION;
static var nDEFAULT_BRAKING = com.disney.gem.games.mickeyFriendsTownRace.GameData.nDEFAULT_BRAKING;
static var nDEFAULT_MAX_SPEED = com.disney.gem.games.mickeyFriendsTownRace.GameData.nDEFAULT_MAX_SPEED;
static var nDEFAULT_MAX_BACK_UP_SPEED = 0;
static var nFULLTHROTTLE_MULT = com.disney.gem.games.mickeyFriendsTownRace.GameData.nFULLTHROTTLE_MULT;
static var nFULLTHROTTLE_DURATION = com.disney.gem.games.mickeyFriendsTownRace.GameData.nFULLTHROTTLE_DURATION;
static var nCAR_COLLISION_CHECK_DIST = 150;
static var nBONUS_CATCH_DIST = com.disney.gem.games.mickeyFriendsTownRace.GameData.nBONUS_CATCH_DIST;
static var nINVINCIBILITY_DURATION = com.disney.gem.games.mickeyFriendsTownRace.GameData.nINVINCIBILITY_DURATION;
static var nSPEED_BOOST_AT_START = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSPEED_BOOST_AT_START;
}
Symbol 942 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase
{
var oCarStats, oCar, fClassConstructor;
function CarTypeBase () {
oCarStats = new com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarStatsValues();
}
function setCar(_oCar) {
oCar = _oCar;
}
function destroy() {
delete oCar;
oCarStats.destroy();
delete oCarStats;
delete fClassConstructor;
}
}
Symbol 943 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarStatsValues] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarStatsValues
{
var nAcceleration, nMaxSpeed, nRoadHandling, nFrameSpeed, nFrameRoadHandling, nFrameStamina;
function CarStatsValues () {
nAcceleration = 0;
nMaxSpeed = 0;
nRoadHandling = 0;
nFrameSpeed = 1;
nFrameRoadHandling = 1;
nFrameStamina = 1;
}
function destroy() {
}
}
Symbol 944 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.Attack] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.Attack extends com.sarbakan.utils.StateManaged
{
var oCoord, mcRef, oMoveVect, setState, stateFinished;
function Attack (_mcRef, _nCarSpeed) {
super(_mcRef);
oCoord = new flash.geom.Point(mcRef._x, mcRef._y);
oMoveVect = new com.disney.gem.games.mickeyFriendsTownRace.lib.Vector();
var _local5 = com.sarbakan.utils.MoreMath.getRadianFromDegree(mcRef._rotation);
oMoveVect.vx = Math.cos(_local5);
oMoveVect.vy = Math.sin(_local5);
oMoveVect = oMoveVect.mult(nMOVE_SPEED + _nCarSpeed);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
setState(sSTATE_IDLE, true);
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().addAttack(this);
}
function onHit() {
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().removeAttack(this);
setState(sSTATE_EXPLODES, true);
}
function onUpdate() {
super.onUpdate();
}
function destroy() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().removeAttack(this);
mcRef.removeMovieClip();
super.destroy();
}
function state_Explodes() {
if (stateFinished()) {
destroy();
}
}
function state_Idle() {
oCoord = oCoord.add(com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.VectorToPoint(oMoveVect));
mcRef._x = oCoord.x;
mcRef._y = oCoord.y;
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.oInstance.getZoneType(oCoord);
if (_local2 == com.disney.gem.games.mickeyFriendsTownRace.game.map.ReactionManager.nZONE_TYPE_COLLIDE) {
onHit();
}
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_EXPLODES = "Explodes";
static var nMOVE_SPEED = com.disney.gem.games.mickeyFriendsTownRace.GameData.nATTACK_MOVE_SPEED;
}
Symbol 945 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.Bonus] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.Bonus extends com.sarbakan.utils.StateManaged
{
var nType, nHiddenTime, oCoord, mcRef, setState, sState, stateFinished;
function Bonus (_mcRef, _nType) {
super(_mcRef);
nType = _nType;
nHiddenTime = 0;
oCoord = new flash.geom.Point(mcRef._x, mcRef._y);
setState(sSTATE_IDLE, true);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
}
function isAvailable() {
return(sState == sSTATE_IDLE);
}
function onCatched() {
setState(sSTATE_OUT, true);
}
function destroy() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
super.destroy();
}
function state_In() {
if (stateFinished()) {
setState(sSTATE_IDLE, true);
}
}
function state_Out() {
if (stateFinished()) {
setState(sSTATE_HIDDEN, true);
nHiddenTime = 0;
}
}
function state_Hidden() {
nHiddenTime++;
if (nHiddenTime >= nHIDE_TIME) {
setState(sSTATE_IN, true);
}
}
static var nHIDE_TIME = com.disney.gem.games.mickeyFriendsTownRace.GameData.nBONUS_HIDE_TIME;
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_IDLE = "Idle";
static var sSTATE_IN = "In";
static var sSTATE_OUT = "Out";
static var nTYPE_POINTS_5K = 1;
static var nTYPE_POINTS_2K = 2;
static var nTYPE_TOON = 3;
static var nTYPE_REPAIR = 4;
static var nTYPE_SPEED = 5;
}
Symbol 946 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase
{
var oCar;
function CarControllerBase (_oCar) {
oCar = _oCar;
}
function startRace() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
}
function destroy() {
delete oCar;
}
}
Symbol 947 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerHuman extends com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase
{
static var oInstance;
var bDeadDiscovered, bWatchEnd, bSpeedBoostKeyDepressed, bAttackKeyDepressed, bSkipKeyDepressed, nNextPositionCalculation, oCar, nEndWait;
function CarControllerHuman (_oCar) {
super(_oCar);
oInstance = this;
bDeadDiscovered = false;
bWatchEnd = false;
bSpeedBoostKeyDepressed = false;
bAttackKeyDepressed = false;
bSkipKeyDepressed = false;
nNextPositionCalculation = 0;
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcPlayer.gotoAndStop(oCar.oCarType.nCarType);
updateLapInfo();
updateHealthStamina();
updateSpeedInfo();
oCar.calculatePosition();
updatePosition();
}
function onKeyDown() {
switch (Key.getCode()) {
case nKEY_SPEED_BOOST :
if (!bSpeedBoostKeyDepressed) {
bSpeedBoostKeyDepressed = true;
var _local2 = oCar.activateBoost();
}
break;
case nKEY_ATTACK :
if (bAttackKeyDepressed) {
break;
}
bAttackKeyDepressed = true;
var _local3 = oCar.launchAttack();
}
}
function onKeyUp() {
switch (Key.getCode()) {
case nKEY_SPEED_BOOST :
bSpeedBoostKeyDepressed = false;
break;
case nKEY_ATTACK :
bAttackKeyDepressed = false;
break;
case nKEY_SKIP :
bSkipKeyDepressed = false;
}
}
function onUpdate() {
if (Key.isDown(Key.RIGHT)) {
oCar.turnRight();
} else if (Key.isDown(Key.LEFT)) {
oCar.turnLeft();
} else {
oCar.goStraight();
}
if (Key.isDown(Key.UP)) {
oCar.accelerate();
} else if (Key.isDown(Key.DOWN)) {
oCar.applyBreak();
} else {
oCar.cruise();
}
nNextPositionCalculation--;
if (nNextPositionCalculation <= 0) {
oCar.calculatePosition();
updatePosition();
nNextPositionCalculation = nPOSITION_CALCULATION_INTERVAL;
}
updateLapInfo();
updateHealthStamina();
updateSpeedInfo();
if (bWatchEnd) {
watchEnd();
}
if (oCar.bDead && (!bDeadDiscovered)) {
bDeadDiscovered = true;
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().calculateCpusPosition();
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().showPlayerDiedPop();
startEndWatch();
}
}
function startRace() {
super.startRace();
Key.addListener(this);
}
function startEndWatch() {
bWatchEnd = true;
nEndWait = 0;
}
function destroy() {
super.destroy();
delete oInstance;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
}
function toString() {
return("[CarControllerHuman]");
}
function watchEnd() {
if (oCar.getSpeed() == 0) {
nEndWait++;
if (nEndWait >= nAFTER_END_STOP_WAIT_TIME) {
com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().onPlayerComplete(oCar.nFinalPosition);
bWatchEnd = false;
}
}
}
function updateHealthStamina() {
var _local2 = (com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcDamage._totalFrames - Math.floor(oCar.getHealthPercentage() * com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcDamage._totalFrames)) + 1;
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcDamage.gotoAndStop(_local2);
var _local3 = (com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcStamina._totalFrames - Math.floor(oCar.getStaminaPercentage() * com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcStamina._totalFrames)) + 1;
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcStamina.gotoAndStop(_local3);
}
function updatePosition() {
if (oCar.nFinalPosition != undefined) {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcRank.txtRank.text = oCar.nFinalPosition;
} else {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcRank.txtRank.text = oCar.nRank;
}
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcRank.mcSuffix.gotoAndStop(oCar.nRank);
}
function updateSpeedInfo() {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcSpeed.txtSpeed.text = oCar.nSpeedBoostAvailable;
}
function updateLapInfo() {
var _local2 = Math.min(oCar.nLapsCompleted, com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getLapsQty());
_local2 = Math.max(1, _local2);
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcLaps.txtCurrent.text = _local2;
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().getHUD().mcLaps.txtTotal.text = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getLapsQty();
}
static var nPOSITION_CALCULATION_INTERVAL = 10;
static var nAFTER_END_STOP_WAIT_TIME = 25;
static var nKEY_ATTACK = String("B").charCodeAt(0);
static var nKEY_SPEED_BOOST = Key.SPACE;
static var nKEY_SKIP = Key.END;
}
Symbol 948 MovieClip [__Packages.com.sarbakan.sound.SoundManager] Frame 0
class com.sarbakan.sound.SoundManager
{
static var aSounds, mcAttach, nSoundNum, aSoundCategories, nMasterVolume, oEnterFrameListener;
function SoundManager () {
}
static function doPlaySound(_sLinkage, _nVolume, _nLoop, _bUnique) {
return(doPlaySoundInCat(sDEFAULT_CATEGORY, _sLinkage, _nVolume, _nLoop, _bUnique));
}
static function doPlaySoundInCat(_sCategoryName, _sLinkage, _nVolume, _nLoop, _bUnique) {
doCheckInit();
if (NewSoundAllowed) {
if (_nVolume == undefined) {
_nVolume = 100;
}
if (_nLoop == undefined) {
_nLoop = 1;
}
if (_bUnique == undefined) {
_bUnique = false;
}
if (_bUnique) {
var _local9 = isSoundPlaying(_sLinkage);
if (_local9.bPlaying) {
var _local8 = false;
var _local7 = _local9.oSound;
} else {
var _local8 = true;
}
} else {
var _local8 = true;
}
if (_local8) {
doManageCategory(_sCategoryName);
var _local10 = getMCForSound();
var _local11 = new Sound(_local10);
_local11.attachSound(_sLinkage);
if (_local11.duration != undefined) {
var _local7 = new com.sarbakan.sound.SoundItem(_local11, _sLinkage, _nVolume, _nLoop, _sCategoryName, _local10);
}
_local7.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_local7);
}
}
return(_local7);
}
static function isSoundPlaying(_sLinkageName) {
var _local3 = new Object();
_local3.bPlaying = false;
_local3.oSound = undefined;
var _local4 = aSounds.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSounds[_local4].LinkageName == _sLinkageName) {
_local3.oSound = aSounds[_local4];
_local3.bPlaying = true;
}
}
return(_local3);
}
function getPlayingQty(_sLinkageName) {
var _local3 = 0;
var _local4 = aSounds.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSounds[_local4].LinkageName == _sLinkageName) {
_local3++;
}
}
return(_local3);
}
static function doManageExternalSound(_oSound) {
doCheckInit();
doManageCategory(_oSound.Category);
_oSound.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_oSound);
}
static function getMCForSound() {
var _local2 = getNextDepth();
var _local3 = mcAttach.createEmptyMovieClip("Snd" + _local2, _local2);
return(_local3);
}
static function getNextDepth() {
nSoundNum++;
return(nSoundNum);
}
static function doInit(_mcAttach) {
if (!bInited) {
mcAttach = _mcAttach;
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 100;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = com.sarbakan.utils.Delegate.create(com.sarbakan.sound.SoundManager, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
}
static function doEnterFrame() {
var _local2 = aSounds.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
aSounds[_local2].doEnterFrame();
}
}
static function setCategoryVolume(_sCategoryName, _nVol) {
doManageCategory(_sCategoryName);
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
aSoundCategories[_local4].nVolume = _nVol;
}
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
var _local3 = aSoundCategories[_local4].nVolume;
}
}
return(_local3);
}
static function isCategoryMuted(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
var _local3 = aSoundCategories[_local4].bMuted;
}
}
return(_local3);
}
static function doSoundEvent(_nEvent, _oSound) {
if (!(_nEvent === nEVENT_SOUND_COMPLETE)) {
} else {
var _local4 = false;
var _local5 = aSounds.length - 1;
for ( ; _local5 >= 0 ; _local5--) {
if (!_local4) {
if (aSounds[_local5] == _oSound) {
_local4 = true;
delete aSounds[_local5];
aSounds.splice(Number(_local5), 1);
}
}
}
}
}
static function doMuteCategory(_sCategoryName) {
var _local3 = aSoundCategories.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
aSoundCategories[_local3].bMuted = true;
}
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(_sCategoryName) {
var _local3 = aSoundCategories.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
aSoundCategories[_local3].bMuted = false;
}
}
doUpdateAllSoundsVolume();
}
static function setMasterVolume(_nVol) {
nMasterVolume = _nVol;
doUpdateAllSoundsVolume();
}
static function __get__NewSoundAllowed() {
return(aSounds.length < nMAX_SOUNDS_PLAYING);
}
static function __get__MasterVolume() {
return(nMasterVolume);
}
static function doRemoveListenerFromAllSounds(_oListener) {
var _local3 = aSounds.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
aSounds[_local3].doRemoveListener(_oListener);
}
}
static function doDestroy() {
doRemoveListenerFromAllSounds();
var _local2 = aSounds.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
aSounds[_local2].doDestroy();
}
mcAttach.removeMovieClip();
delete mcAttach;
nSoundNum = 0;
bInited = false;
nMasterVolume = 100;
delete aSounds;
delete aSoundCategories;
delete oEnterFrameListener;
}
static function __get__Inited() {
return(bInited);
}
static function doUpdateAllSoundsVolume() {
var _local2 = aSounds.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
aSounds[_local2].doUpdateSound();
}
}
static function doCheckInit() {
if (!bInited) {
}
}
static function doManageCategory(_sCategoryName) {
doCheckInit();
var _local3 = false;
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
_local3 = true;
}
}
if (!_local3) {
var _local5 = new Object();
_local5.sName = _sCategoryName;
_local5.nVolume = 100;
_local5.bMuted = false;
aSoundCategories.push(_local5);
}
}
static var nEVENT_SOUND_COMPLETE = 1;
static var sDEFAULT_CATEGORY = "SFX";
static var nMAX_SOUNDS_PLAYING = 32;
static var bInited = false;
}
Symbol 949 MovieClip [__Packages.com.sarbakan.sound.SoundItem] Frame 0
class com.sarbakan.sound.SoundItem
{
var sndObj, sLinkage, mcRef, nRemainingLoop, nCurrentVolume, nTargetVolume, nFadeRate, sCategory, bFadeAtEnd, bMuted, bPaused, bNeedFreshStart, nCurrentTime, aEventListeners, bStopAfterFade;
function SoundItem (_sndObject, _sLinkage, _nVolume, _nLoop, _sCategory, _mc) {
sndObj = _sndObject;
sLinkage = _sLinkage;
mcRef = _mc;
nRemainingLoop = _nLoop;
nCurrentVolume = _nVolume;
nTargetVolume = _nVolume;
nFadeRate = nFADE_RATE;
sCategory = _sCategory;
bFadeAtEnd = false;
bMuted = false;
bPaused = false;
bNeedFreshStart = false;
sndObj.onSoundComplete = com.sarbakan.utils.Delegate.create(this, doSoundComplete);
doStart(_nLoop);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
nCurrentTime = 0;
aEventListeners = new Array();
}
function doEnterFrame() {
if (!bPaused) {
if (nCurrentTime > sndObj.position) {
nRemainingLoop--;
}
nCurrentTime = sndObj.position;
}
doCheckFadeAtEnd();
doManageFade();
}
function doAddListener(_oListener) {
aEventListeners.push(_oListener);
}
function doRemoveListener(_oListener) {
var _local3 = 0;
for ( ; _local3 < aEventListeners.length ; _local3++) {
if (aEventListeners[_local3] == _oListener) {
delete aEventListeners[_local3];
aEventListeners.splice(_local3, 1);
}
}
}
function doSoundComplete() {
if (bNeedFreshStart && (nRemainingLoop > 1)) {
sndObj.start(0, nRemainingLoop - 1);
} else {
doManageEndEvent();
}
}
function doUpdateSound() {
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
function doMute() {
bMuted = true;
doUpdateSound();
}
function doUnMute() {
bMuted = false;
doUpdateSound();
}
function doPause() {
sndObj.stop();
bPaused = true;
}
function doResume() {
bPaused = false;
bNeedFreshStart = true;
sndObj.start(nCurrentTime / 1000, 1);
}
function doStart(_nLoop) {
if (_nLoop == undefined) {
_nLoop = 1;
}
if (sLinkage.indexOf(".mp3") != -1) {
sndObj.start(15 / 1000, _nLoop);
} else {
sndObj.start(0, _nLoop);
}
}
function doStop() {
sndObj.stop();
doManageEndEvent();
}
function doFadeTo(_nVolume, _bStopAndDelete) {
if (_bStopAndDelete == undefined) {
_bStopAndDelete = true;
}
bStopAfterFade = _bStopAndDelete;
nTargetVolume = _nVolume;
}
function setFadeRate(_nRate) {
if (_nRate == undefined) {
_nRate = nFADE_RATE;
}
nFadeRate = _nRate;
}
function setFadeAtEnd(_bFadeAtEnd) {
bFadeAtEnd = true;
}
function setPan(_nPan) {
sndObj.setPan(_nPan);
}
function get Category() {
return(sCategory);
}
function get LinkageName() {
return(sLinkage);
}
function doDestroy() {
sndObj.stop();
delete sndObj;
mcRef.removeMovieClip();
}
function doCheckFadeAtEnd() {
if (bFadeAtEnd) {
if (nRemainingLoop == 1) {
if ((sndObj.duration - nCurrentTime) <= nFADE_AT_END_TIME) {
doFadeTo(0);
}
}
}
}
function doManageEndEvent() {
var _local2 = 0;
for ( ; _local2 < aEventListeners.length ; _local2++) {
aEventListeners[_local2].doSoundEvent(com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE, this);
}
aEventListeners = new Array();
mcRef.removeMovieClip();
delete mcRef;
delete aEventListeners;
delete sndObj.onSoundComplete;
delete sndObj;
}
function doManageFade() {
if (nCurrentVolume != nTargetVolume) {
nCurrentVolume = com.sarbakan.utils.MoreMath.getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
if ((nCurrentVolume <= 0) && (bStopAfterFade)) {
sndObj.stop();
doManageEndEvent();
}
}
function returnComputedVolume(_nVolume) {
if ((!bMuted) && (!com.sarbakan.sound.SoundManager.isCategoryMuted(sCategory))) {
var _local4 = com.sarbakan.sound.SoundManager.MasterVolume / 100;
var _local5 = com.sarbakan.sound.SoundManager.getCategoryVolume(sCategory) / 100;
var _local3 = _nVolume;
_local3 = _local3 * _local5;
_local3 = _local3 * _local4;
} else {
var _local3 = 0;
}
return(_local3);
}
static var nFADE_RATE = 8;
static var nFADE_AT_END_TIME = 800;
}
Symbol 950 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local2 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local2);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
}
Symbol 951 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local3 = _listeners;
var _local4 = _local3.length;
while (_local4--) {
if (_local3[_local4] == o) {
_local3.splice(_local4, 1);
if (!_local3.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local2 = String(arguments.shift());
var _local3 = _listeners.concat();
var _local4 = _local3.length;
var _local5 = 0;
for ( ; _local5 < _local4 ; _local5++) {
_local3[_local5][_local2].apply(_local3[_local5], arguments);
}
}
}
Symbol 952 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.Obstacle] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.Obstacle
{
var oCoord, nRadius;
function Obstacle (_oCoord, _nRadius) {
oCoord = _oCoord;
nRadius = _nRadius;
}
}
Symbol 953 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = begin;
this.duration = duration;
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = finish;
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local3 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local3) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
_global.updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = finish;
if (duration != undefined) {
this.duration = duration;
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = _global.setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
_global.clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = _duration;
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = (getTimer() - _startTime) / 1000;
} else {
time = _time + 1;
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = _time - 1;
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = getPosition(_time);
}
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 954 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
}
Symbol 955 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.GoAnim] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.GoAnim extends com.sarbakan.utils.StateManaged
{
var setState, fEndCall, stateFinished;
function GoAnim (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN, true);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
}
function showGo(_fEndCall, _bSpecialSound) {
fEndCall = _fEndCall;
setState(sSTATE_GO, true);
if (_bSpecialSound) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "3_2_1_GoExtended.wav");
} else {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.mickeyFriendsTownRace.Controller.sSOUND_CAT_SFX, "3_2_1_Go.wav");
}
}
function destroy() {
delete fEndCall;
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
super.destroy();
}
function state_Go() {
if (stateFinished()) {
fEndCall();
setState(sSTATE_HIDDEN, true);
delete fEndCall;
}
}
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_GO = "Go";
}
Symbol 956 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.FinalAnim] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.FinalAnim extends com.sarbakan.utils.StateManaged
{
var setState, nPosition, mcRef, stateFinished;
function FinalAnim (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN, true);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.addListener(this);
}
function showAnim(_nPosition) {
nPosition = _nPosition;
setState(sSTATE_ANIM, true);
mcRef.mcState.mcPos.gotoAndStop(nPosition);
}
function destroy() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
super.destroy();
}
function state_Anim() {
if (stateFinished()) {
setState(sSTATE_END, true);
mcRef.mcState.mcPos.gotoAndStop(nPosition);
}
}
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_ANIM = "Anim";
static var sSTATE_END = "End";
}
Symbol 957 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.map.PartialMapBitmap] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.map.PartialMapBitmap
{
var oCoordinates, oBitmapData;
function PartialMapBitmap () {
oCoordinates = new flash.geom.Point(0, 0);
}
function destroy() {
oBitmapData.dispose();
delete oBitmapData;
delete oCoordinates;
}
}
Symbol 958 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.RacerScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.RacerScreen extends com.sarbakan.utils.ScreenController
{
var oCurrentCar, oCar1, mcRef, oCar2, oCar3, oCar4;
function RacerScreen (_mcRef) {
super(_mcRef);
}
function onBtBack() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().goBackToTitle();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function onSelectionComplete() {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().startGameWithCar(oCurrentCar);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function state_idle_init() {
super.state_idle_init();
oCar1 = new com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton(mcRef.mcState.mcContent.mcCar1);
oCar1.oCarType = new com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMickey();
oCar1.setClickCallBack(com.sarbakan.utils.Delegate.create(this, selectCar, oCar1));
oCar2 = new com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton(mcRef.mcState.mcContent.mcCar2);
oCar2.oCarType = new com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMinnie();
oCar2.setClickCallBack(com.sarbakan.utils.Delegate.create(this, selectCar, oCar2));
oCar3 = new com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton(mcRef.mcState.mcContent.mcCar3);
oCar3.oCarType = new com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeGoofy();
oCar3.setClickCallBack(com.sarbakan.utils.Delegate.create(this, selectCar, oCar3));
oCar4 = new com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton(mcRef.mcState.mcContent.mcCar4);
oCar4.oCarType = new com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeDonald();
oCar4.setClickCallBack(com.sarbakan.utils.Delegate.create(this, selectCar, oCar4));
selectCar(oCar1);
mcRef.mcState.mcContent.btContinue.onRelease = com.sarbakan.utils.Delegate.create(this, onSelectionComplete);
mcRef.mcState.mcContent.btnBack.onRelease = com.sarbakan.utils.Delegate.create(this, onBtBack);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btContinue);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btnBack);
}
function selectCar(_oCarBtn) {
oCurrentCar = _oCarBtn.oCarType;
oCar1.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton.sSTATE_OFF, true);
oCar2.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton.sSTATE_OFF, true);
oCar3.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton.sSTATE_OFF, true);
oCar4.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton.sSTATE_OFF, true);
if (com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().isLastDriverLocked()) {
oCar4.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton.sSTATE_LOCKED, true);
}
_oCarBtn.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton.sSTATE_SELECTED, true);
mcRef.mcState.mcContent.mcGaugeSpeed.gotoAndStop(_oCarBtn.oCarType.oCarStats.nFrameSpeed);
mcRef.mcState.mcContent.mcGaugeHandling.gotoAndStop(_oCarBtn.oCarType.oCarStats.nFrameRoadHandling);
mcRef.mcState.mcContent.mcGaugeStamina.gotoAndStop(_oCarBtn.oCarType.oCarStats.nFrameStamina);
}
}
Symbol 959 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.RacerSelectButton extends com.sarbakan.utils.StateManaged
{
var setState, fClickCB, mcRef;
function RacerSelectButton (_mcRef) {
super(_mcRef);
setState(sSTATE_OFF, true);
}
function onClick() {
fClickCB();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function setClickCallBack(_fClickCB) {
fClickCB = _fClickCB;
}
function state_Off_end() {
delete mcRef.onRelease;
delete mcRef.onRollOver;
}
function state_Off_init() {
mcRef.onRelease = com.sarbakan.utils.Delegate.create(this, onClick);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef);
}
static var sSTATE_OFF = "Off";
static var sSTATE_SELECTED = "Selected";
static var sSTATE_LOCKED = "Locked";
}
Symbol 960 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMickey] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMickey extends com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase
{
var oCarStats, fClassConstructor, sVisualLinkage, sAttackLinkage, nCarType;
function CarTypeMickey () {
super();
oCarStats.nAcceleration = 2;
oCarStats.nMaxSpeed = 0.7;
oCarStats.nRoadHandling = 2.1;
oCarStats.nStamina = 1.3;
oCarStats.nFrameSpeed = 5;
oCarStats.nFrameRoadHandling = 10;
oCarStats.nFrameStamina = 9;
fClassConstructor = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMickey;
sVisualLinkage = "mcCar_Mickey";
sAttackLinkage = "ANIM_D_TR_ItemMickey";
nCarType = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_MICKEY;
}
}
Symbol 961 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMinnie] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMinnie extends com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase
{
var oCarStats, fClassConstructor, sVisualLinkage, sAttackLinkage, nCarType;
function CarTypeMinnie () {
super();
oCarStats.nAcceleration = 2;
oCarStats.nMaxSpeed = 0.85;
oCarStats.nRoadHandling = 2.1;
oCarStats.nStamina = 0.8;
oCarStats.nFrameSpeed = 7;
oCarStats.nFrameRoadHandling = 10;
oCarStats.nFrameStamina = 5;
fClassConstructor = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeMinnie;
sVisualLinkage = "mcCar_Minnie";
sAttackLinkage = "ANIM_D_TR_ItemMinnie";
nCarType = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_MINNIE;
}
}
Symbol 962 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeGoofy] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeGoofy extends com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase
{
var oCarStats, fClassConstructor, sVisualLinkage, sAttackLinkage, nCarType;
function CarTypeGoofy () {
super();
oCarStats.nAcceleration = 1;
oCarStats.nMaxSpeed = 0.85;
oCarStats.nRoadHandling = 1.4;
oCarStats.nStamina = 1.2;
oCarStats.nFrameSpeed = 7;
oCarStats.nFrameRoadHandling = 4;
oCarStats.nFrameStamina = 9;
fClassConstructor = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeGoofy;
sVisualLinkage = "mcCar_Goofy";
sAttackLinkage = "ANIM_D_TR_ItemGoffy";
nCarType = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_GOOFY;
}
}
Symbol 963 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeDonald] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeDonald extends com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeBase
{
var oCarStats, fClassConstructor, sVisualLinkage, sAttackLinkage, nCarType;
function CarTypeDonald () {
super();
oCarStats.nAcceleration = 1.05;
oCarStats.nMaxSpeed = 1;
oCarStats.nRoadHandling = 1.6;
oCarStats.nStamina = 0.5;
oCarStats.nFrameSpeed = 10;
oCarStats.nFrameRoadHandling = 7;
oCarStats.nFrameStamina = 2;
fClassConstructor = com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarTypeDonald;
sVisualLinkage = "mcCar_Donald";
sAttackLinkage = "ANIM_D_TR_ItemDonald";
nCarType = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCAR_DONALD;
}
}
Symbol 964 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.ContestantInfo] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.ContestantInfo
{
var nPreviousPoints, nPoints;
function ContestantInfo () {
nPreviousPoints = (nPoints = 0);
}
}
Symbol 965 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerComputer] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerComputer extends com.disney.gem.games.mickeyFriendsTownRace.game.cars.CarControllerBase
{
var nNextAttackDelay, oCar, nRateWaitCurrent, nRateWaitTarget, nNextRateChangeCurrent, nNextRateChangeTarget;
function CarControllerComputer (_oCar) {
super(_oCar);
nNextAttackDelay = 0;
oCar.oCarType.oCarStats.nMaxSpeed = oCar.oCarType.oCarStats.nMaxSpeed * 0.8;
}
function onUpdate() {
var _local2 = oCar.oRouteNodeNext.oCoord;
var _local3 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(_local2.subtract(oCar.oCoord));
var _local4 = _local3.sign(com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCar.getFacing()));
var _local5 = _local3.angl(com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCar.getFacing()), true);
if ((_local4 > 0) && (_local5 > nMINIMUM_ANGLE_FOR_STEER)) {
oCar.turnLeft();
} else if ((_local4 < 0) && (_local5 > nMINIMUM_ANGLE_FOR_STEER)) {
oCar.turnRight();
} else {
oCar.goStraight();
}
nRateWaitCurrent++;
if (nRateWaitCurrent >= nRateWaitTarget) {
oCar.accelerate();
nRateWaitCurrent = 0;
} else if (oCar.getSpeed() >= (oCar.getSpeedMax() * nSPEED_RATIO_MIN)) {
oCar.cruise();
} else {
oCar.accelerate();
if (oCar.nSpeedBoostAvailable > 0) {
if ((oCar.getState() != com.disney.gem.games.mickeyFriendsTownRace.game.CarBase.sSTATE_FULLTHROTTLE) && (oCar.nFullThrottleDuration <= 0)) {
if (oCar.oRouteNodeNext.oCoord.subtract(oCar.oCoord).length >= nMIN_NEXT_NODE_DIST_FOR_BOOST) {
if (com.sarbakan.utils.MoreMath.getRandomRange(1, 100) <= nTAKE_BOOST_PROBABILITY) {
oCar.activateBoost();
}
}
}
}
}
nNextAttackDelay--;
if (nNextAttackDelay <= 0) {
checkOpponents();
}
nNextRateChangeCurrent++;
if (nNextRateChangeCurrent >= nNextRateChangeTarget) {
takeNewRate();
}
}
function destroy() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().oMainBroadcaster.removeListener(this);
}
function toString() {
return("[CarControllerComputer]");
}
function checkOpponents() {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.game.LevelManager.getInstance().getAllCars();
if (_local2.length != undefined) {
var _local3 = 0;
for ( ; _local3 <= (_local2.length - 1) ; _local3++) {
var _local4 = _local2[_local3];
if (_local4 != oCar) {
var _local5 = _local4.oCoord.subtract(oCar.oCoord).length;
if (_local5 <= nSHOOT_OPPONENT_DIST) {
var _local6 = _local4.oCoord;
var _local7 = com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.PointToVector(_local6.subtract(oCar.oCoord));
var _local8 = _local7.angl(com.disney.gem.games.mickeyFriendsTownRace.lib.Vector.Normalize(oCar.getFacing()), true);
if (com.sarbakan.utils.MoreMath.getRandomRange(1, 100) <= nSHOOT_OPPONENT_PROBABILITY) {
if (_local8 <= nSHOOT_OPPONENT_ANGL) {
var _local9 = oCar.launchAttack();
if (_local9) {
nNextAttackDelay = nSHOOT_OPPONENT_DELAY;
}
}
}
}
}
}
}
}
function takeNewRate() {
nNextRateChangeTarget = com.sarbakan.utils.MoreMath.getRandomRange(nSPEED_RATE_CHANGE_MIN, nSPEED_RATE_CHANGE_MAX);
nNextRateChangeCurrent = 0;
nRateWaitTarget = com.sarbakan.utils.MoreMath.getRandomRange(nSPEED_RATE_WAIT_MIN, nSPEED_RATE_WAIT_MAX);
nRateWaitCurrent = 0;
}
static var nMINIMUM_ANGLE_FOR_STEER = 5;
static var nSPEED_RATE_CHANGE_MIN = 15;
static var nSPEED_RATE_CHANGE_MAX = 45;
static var nSPEED_RATE_WAIT_MIN = 1;
static var nSPEED_RATE_WAIT_MAX = 5;
static var nSPEED_RATIO_MIN = 0.2;
static var nMIN_NEXT_NODE_DIST_FOR_BOOST = com.disney.gem.games.mickeyFriendsTownRace.GameData.nMIN_NEXT_NODE_DIST_FOR_BOOST;
static var nTAKE_BOOST_PROBABILITY = com.disney.gem.games.mickeyFriendsTownRace.GameData.nTAKE_BOOST_PROBABILITY;
static var nSHOOT_OPPONENT_DELAY = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSHOOT_OPPONENT_DELAY;
static var nSHOOT_OPPONENT_PROBABILITY = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSHOOT_OPPONENT_PROBABILITY;
static var nSHOOT_OPPONENT_ANGL = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSHOOT_OPPONENT_ANGL;
static var nSHOOT_OPPONENT_DIST = com.disney.gem.games.mickeyFriendsTownRace.GameData.nSHOOT_OPPONENT_DIST;
}
Symbol 966 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.ModeScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.ModeScreen extends com.sarbakan.utils.ScreenController
{
var mcRef, oMode1, oMode2, oMode3;
function ModeScreen (_mcRef) {
super(_mcRef);
}
function onBtBack() {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().backToCarSelect();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function useMode(_oMode) {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().userSelectedMode(_oMode.nModeNum);
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.mcContent.btnBack.onRelease = com.sarbakan.utils.Delegate.create(this, onBtBack);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btnBack);
oMode1 = new com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton(mcRef.mcState.mcContent.mcMode1);
oMode1.nModeNum = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nPLAYMODE_TOON;
oMode1.setClickCallBack(com.sarbakan.utils.Delegate.create(this, useMode, oMode1));
oMode2 = new com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton(mcRef.mcState.mcContent.mcMode2);
oMode2.nModeNum = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nPLAYMODE_MIRROR;
oMode2.setClickCallBack(com.sarbakan.utils.Delegate.create(this, useMode, oMode2));
oMode3 = new com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton(mcRef.mcState.mcContent.mcMode3);
oMode3.nModeNum = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nPLAYMODE_LAST;
oMode3.setClickCallBack(com.sarbakan.utils.Delegate.create(this, useMode, oMode3));
oMode1.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton.sSTATE_ON, true);
oMode2.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton.sSTATE_ON, true);
oMode3.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton.sSTATE_ON, true);
if (!com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().bCompletedToon) {
oMode2.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton.sSTATE_OFF, true);
}
if (!com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().bCompletedMirror) {
oMode3.setState(com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton.sSTATE_OFF, true);
}
}
}
Symbol 967 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.ModeSelectButton extends com.sarbakan.utils.StateManaged
{
var setState, fClickCB, mcRef;
function ModeSelectButton (_mcRef) {
super(_mcRef);
setState(sSTATE_OFF, true);
}
function onClick() {
fClickCB();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function setClickCallBack(_fClickCB) {
fClickCB = _fClickCB;
}
function state_Off_init() {
mcRef.mcState.btSelect.onRelease = function () {
};
mcRef.mcState.btSelect.onRollOver = function () {
};
}
function state_On_init() {
mcRef.mcState.btSelect.onRelease = com.sarbakan.utils.Delegate.create(this, onClick);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.btSelect);
}
static var sSTATE_OFF = "Off";
static var sSTATE_ON = "On";
}
Symbol 968 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.RaceCompleteScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.RaceCompleteScreen extends com.sarbakan.utils.ScreenController
{
var mcRef;
function RaceCompleteScreen (_mcRef) {
super(_mcRef);
}
function onBtNext() {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().playNextRace();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function state_idle_init() {
super.state_idle_init();
showRows();
mcRef.mcState.mcContent.mcStats.txtBonus.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().nPointsBonuses);
mcRef.mcState.mcContent.mcStats.txtDamage.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().nPointsDamage);
mcRef.mcState.mcContent.mcStats.txtStamina.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().nPointsStamina);
mcRef.mcState.mcContent.mcStats.txtTotal.text = com.sarbakan.utils.Tools.getFormatedNumber((com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().nPointsBonuses + com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().nPointsDamage) + com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().nPointsStamina);
mcRef.mcState.mcContent.btNext.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNext);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btNext);
}
function showRows() {
var _local2 = mcRef.mcState.mcContent.mcRows;
var _local3 = com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().aContestantsData.concat();
var _local4 = function (_oContestant1, _oContestant2) {
var _local4 = _oContestant1.nPoints - _oContestant1.nPreviousPoints;
var _local5 = _oContestant2.nPoints - _oContestant2.nPreviousPoints;
if (_local4 > _local5) {
return(-1);
}
if (_local4 < _local5) {
return(1);
}
return(0);
};
_local3.sort(_local4);
var _local5 = 1;
// unexpected jump
do {
_local5++;
if (_local5 > _local3.length) {
break;
}
} while (com.disney.gem.games.mickeyFriendsTownRace.game.ContestantInfo(_local3[_local5 - 1]).nControllerType != com.disney.gem.games.mickeyFriendsTownRace.GameEngine.nCONTROLLER_HUMAN);
_local2.gotoAndStop(_local5);
if (_local3.length != undefined) {
var _local6 = _local3.length - 1;
for ( ; _local6 >= 0 ; _local6--) {
var _local7 = _local3[_local6];
var _local8 = Number(_local6) + 1;
var _local9 = _local2["mcRow" + _local8];
_local9.txtRank.text = _local8;
_local9.txtRankLetters.text = com.sarbakan.utils.MoreString.getOrdinalSuffix(_local8);
_local9.mcCar.gotoAndStop(_local7.nCarType);
_local9.txtOldPoints.text = _local7.nPreviousPoints;
_local9.txtTotalPoints.text = _local7.nPoints;
_local9.txtNewPoints.text = _local7.nPoints - _local7.nPreviousPoints;
}
}
}
}
Symbol 969 MovieClip [__Packages.com.sarbakan.utils.Tools] Frame 0
class com.sarbakan.utils.Tools
{
function Tools () {
}
static function isItemInArray(_aArray, _oItem) {
var _local4 = false;
var _local5 = _aArray.length - 1;
for ( ; _local5 >= 0 ; _local5--) {
if (_aArray[_local5] == _oItem) {
_local4 = true;
}
}
return(_local4);
}
static function doCopyArray(_aArraySource) {
var _local3 = new Array();
var _local4 = 0;
_local4 = 0;
for ( ; _local4 < _aArraySource.length ; _local4++) {
if (_aArraySource[_local4] instanceof Array) {
_local3.push(doCopyArray(_aArraySource[_local4]));
} else {
_local3.push(_aArraySource[_local4]);
}
}
return(_local3);
}
static function getFormatedNumber(_nNumber, _nMinimumChar) {
return(returnFormatedNumber(_nNumber, _nMinimumChar));
}
static function returnFormatedNumber(_nNumber, _nMinimumChar) {
var _local4 = String(_nNumber);
while (_local4.length < _nMinimumChar) {
_local4 = "0" + _local4;
}
var _local5 = new Array();
var _local6 = _local4.length - 1;
var _local7 = 0;
for ( ; _local7 <= _local6 ; _local7++) {
var _local8 = _local4.charAt(_local7);
_local5.push(_local8);
}
_local4 = "";
var _local9 = 0;
_local7 = _local5.length - 1;
for ( ; _local7 >= 0 ; _local7--) {
if (((_local9 % 3) == 0) && (_local9 != 0)) {
_local4 = "," + _local4;
}
_local4 = _local5[_local7] + _local4;
_local9++;
}
return(_local4);
}
static function getFormatedTime(_nTime, _bIncludeMilliseconds, _bShowMinutes) {
if (_bIncludeMilliseconds == undefined) {
_bIncludeMilliseconds = false;
}
if (_bShowMinutes == undefined) {
_bShowMinutes = true;
}
var _local5 = false;
if (_nTime < 0) {
_local5 = true;
_nTime = Math.abs(_nTime);
}
var _local6 = Math.floor(_nTime / 1000);
if (_bIncludeMilliseconds) {
if (_nTime >= 1000) {
var _local8 = _nTime % (_local6 * 1000);
} else {
var _local8 = _nTime;
}
var _local7 = String(_local8).substr(0, 2);
if (_local7.length <= 1) {
_local7 = "0" + _local7;
}
}
var _local9 = Math.floor(_local6 / 60);
var _local10 = Math.floor(_local6 % 60);
var _local11 = "";
var _local12 = "";
if (_local10 < 10) {
_local12 = "0";
}
if (_local9 < 10) {
_local11 = "0";
}
var _local13 = "";
if (_bShowMinutes) {
_local13 = _local13 + String((_local11 + _local9) + ":");
}
_local13 = _local13 + (_local12 + _local10);
if (_bIncludeMilliseconds) {
_local13 = _local13 + (":" + _local7);
}
if (_local5) {
_local13 = "-" + _local13;
}
return(_local13);
}
static function getTrimmedString(_sStr) {
while (_sStr.charAt(0) == " ") {
_sStr = _sStr.substring(1, _sStr.length);
}
while (_sStr.charAt(_sStr.length - 1) == " ") {
_sStr = _sStr.substring(0, _sStr.length - 1);
}
return(_sStr);
}
}
Symbol 970 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.popups.MenuPopup] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.popups.MenuPopup extends com.sarbakan.utils.ScreenController
{
var oController, hide, mcRef;
function MenuPopup (_mcRef) {
super(_mcRef);
}
function onBtSound() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).toggleSound();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
updateSoundGroup();
}
function onBtHelp() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).allowInstructions();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).showInstructions();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
hide(null, true);
}
function onBtQuit() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).showPopup(new com.disney.gem.games.mickeyFriendsTownRace.popups.ConfirmPopup(com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).mcTimeline.mcPopups.mcConfirm, this), true);
}
function onBtResume() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).unpause();
hide();
}
function state_in_init() {
super.state_in_init();
setBts();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).disallowInstructions();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_out_end() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).allowInstructions();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function state_Idle() {
updateSoundGroup();
}
function setBts() {
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.mcContent.btQuit.onRelease = com.sarbakan.utils.Delegate.create(this, onBtQuit);
mcRef.mcState.mcContent.btResume.onRelease = com.sarbakan.utils.Delegate.create(this, onBtResume);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btHelp);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btQuit);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btResume);
updateSoundGroup();
}
function updateSoundGroup() {
var _local2 = "On";
if (com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).bSoundMuted) {
_local2 = "Off";
}
mcRef.mcState.mcContent.mcSoundToggle.gotoAndStop(_local2);
mcRef.mcState.mcContent.mcSoundToggle.btSound.onRelease = com.sarbakan.utils.Delegate.create(this, onBtSound);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.mcSoundToggle.btSound);
}
}
Symbol 971 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.popups.ConfirmPopup] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.popups.ConfirmPopup extends com.sarbakan.utils.ScreenController
{
var oMenuOrigin, hide, mcRef;
function ConfirmPopup (_mcRef, _oMenuOrigin) {
super(_mcRef);
oMenuOrigin = _oMenuOrigin;
}
function onBtNo() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
hide();
}
function onBtYes() {
hide();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().onGameLose();
oMenuOrigin.hide();
}
function state_in_init() {
super.state_in_init();
setBts();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function setBts() {
mcRef.mcState.mcContent.btYes.onRelease = com.sarbakan.utils.Delegate.create(this, onBtYes);
mcRef.mcState.mcContent.btNo.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNo);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btYes);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btNo);
}
}
Symbol 972 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.CupWinScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.CupWinScreen extends com.sarbakan.utils.ScreenController
{
var mcRef, oController;
function CupWinScreen (_mcRef) {
super(_mcRef);
}
function onBtNext() {
com.disney.gem.games.mickeyFriendsTownRace.GameEngine.getInstance().showModeSelectionScreen();
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().castClickSound();
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.mcContent.btNext.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNext);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setRollSound(mcRef.mcState.mcContent.btNext);
mcRef.mcState.mcContent.mcScore.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).getScore());
}
}
Symbol 973 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.TitleScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.TitleScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function TitleScreen (_mcRef) {
super(_mcRef);
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().allowInstructions();
}
function onBtHelp() {
com.disney.gem.games.mickeyFriendsTownRace.Controller.getInstance().setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).showInstructions();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).castClickSound();
}
function onBtPlay() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).startGame();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).castClickSound();
}
function state_idle_init() {
super.state_idle_init();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).allowInstructions();
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).setRollSound(mcRef.mcState.mcContent.btHelp);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).setRollSound(mcRef.mcState.mcContent.btPlay);
}
}
Symbol 974 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.HelpScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.HelpScreen extends com.sarbakan.utils.ScreenController
{
var mcRef, oController;
function HelpScreen (_mcRef) {
super(_mcRef);
}
function onPagePrevious() {
mcRef.mcState.mcContent.prevFrame();
state_idle_init();
}
function onPageNext() {
mcRef.mcState.mcContent.nextFrame();
state_idle_init();
}
function onBtPlay() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).hideInstructions();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).castClickSound();
}
function onBtNext() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).castClickSound();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).oTransitionManager.playTransition(com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, onPageNext));
}
function onBtBack() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).castClickSound();
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).oTransitionManager.playTransition(com.disney.gem.games.mickeyFriendsTownRace.Controller.sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, onPagePrevious));
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.mcContent.btBack.onRelease = com.sarbakan.utils.Delegate.create(this, onBtBack);
mcRef.mcState.mcContent.btNext.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNext);
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).setRollSound(mcRef.mcState.mcContent.btBack);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).setRollSound(mcRef.mcState.mcContent.btNext);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).setRollSound(mcRef.mcState.mcContent.btPlay);
}
}
Symbol 975 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.EndScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.EndScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function EndScreen (_mcRef) {
super(_mcRef);
}
function onBtPlay() {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).showTitleScreen(true);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).castClickSound();
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).setRollSound(mcRef.mcState.mcContent.btPlay);
mcRef.mcState.mcContent.mcScore.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).getScore());
}
}
Symbol 976 MovieClip [__Packages.com.disney.gem.games.mickeyFriendsTownRace.screens.PreloaderScreen] Frame 0
class com.disney.gem.games.mickeyFriendsTownRace.screens.PreloaderScreen extends com.sarbakan.utils.ScreenController
{
var mcRef, oController;
function PreloaderScreen (_mcRef) {
super(_mcRef);
mcRef.mcState.stop();
}
function state_idle() {
var _local2 = com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).mcTimeline.getBytesLoaded() / com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).mcTimeline.getBytesTotal();
mcRef.mcState.txtPercent.text = Math.round(_local2 * 100);
if (_local2 == 1) {
com.disney.gem.games.mickeyFriendsTownRace.Controller(oController).onPreloadingDone();
}
}
}
Symbol 64 MovieClip Frame 1
this._visible = false;
Symbol 97 MovieClip [ANIM_D_TR_Sheep01] Frame 1
this.sLinkage = "ANIM_D_TR_Sheep01";
Symbol 122 MovieClip [mcBonusPts5K] Frame 1
this.sLinkage = "mcBonusPts5K";
Symbol 136 MovieClip [mcBonusRepair] Frame 1
this.sLinkage = "mcBonusRepair";
Symbol 152 MovieClip [mcBonusToon] Frame 1
this.sLinkage = "mcBonusToon";
Symbol 159 MovieClip [mcBonusPts2K] Frame 1
this.sLinkage = "mcBonusPts2K";
Symbol 175 MovieClip [mcBonusSpeed] Frame 1
this.sLinkage = "mcBonusSpeed";
Symbol 178 MovieClip Frame 1
stop();
Symbol 210 MovieClip [ANIM_D_TR_Blocker04] Frame 1
this.sLinkage = "ANIM_D_TR_Blocker04";
Symbol 231 MovieClip Frame 1
this._visible = false;
Symbol 245 MovieClip [ANIM_D_TR_HydrantState01] Frame 1
this.sLinkage = "ANIM_D_TR_HydrantState01";
Symbol 388 MovieClip Frame 1
stop();
Symbol 424 MovieClip Frame 7
stop();
Symbol 514 MovieClip Frame 1
stop();
Symbol 514 MovieClip Frame 2
stop();