Frame 1
function createSeed(strWord) {
var iOrgData = getCodeArray(strWord);
var iLength = iOrgData.length;
var i;
iOrgData.push(128);
while (iOrgData.length < 56) {
iOrgData.push(0);
}
var dwData = new Array();
i = 0;
while (i < 14) {
var dwTemp = ((((iOrgData[(i * 4) + 3] << 24) | (iOrgData[(i * 4) + 2] << 16)) | (iOrgData[(i * 4) + 1] << 8)) | iOrgData[i * 4]);
dwData.push(dwTemp);
i++;
}
dwData.push(iLength << 3);
dwData.push(0);
return(dwData);
}
function getDigest(dwData) {
var i;
var j;
var iData = new Array(0, 0, 0, 0);
i = 0;
while (i < 4) {
iData[0] = ((iData[0] << 8) | ((3 - i) << 5)) | (7 - (2 * i));
iData[1] = ((iData[1] << 8) | ((7 - i) << 5)) | (15 - (2 * i));
iData[2] = ((iData[2] << 8) | ((9 + (2 * i)) << 4)) | (8 + (2 * i));
iData[3] = ((iData[3] << 8) | ((1 + (2 * i)) << 4)) | (0 + (2 * i));
i++;
}
var iDataResult = new Array(iData[0], iData[1], iData[2], iData[3]);
var stepS = new Array(2927, 3429, 3964, 3430);
var valueS = 0;
i = 0;
while (i < 4) {
var valueK = ((328 >> (i * 3)) & 7);
var stepK = ((3817 >> (i * 3)) & 7);
j = 0;
while (j < 16) {
valueS = (((j % 4) == 0) ? 0 : (valueS)) + ((stepS[i] >> ((j % 4) * 3)) & 7);
var dwData0 = iData[(16 - j) % 4];
var dwData1 = iData[(17 - j) % 4];
var dwData2 = iData[(18 - j) % 4];
var dwData3 = iData[(19 - j) % 4];
var dwSin = parseInt((Math.abs(Math.sin(((i * 16) + j) + 1)) * 65536) * 65536);
var dwTemp = ((dwData0 + dwData[valueK % 16]) + dwSin);
dwTemp = dwTemp + ((i & 2) ? (((i & 1) ? (dwData2 ^ (dwData1 | (~dwData3))) : ((dwData1 ^ dwData2) ^ dwData3))) : (((i & 1) ? ((dwData1 & dwData3) | (dwData2 & (~dwData3))) : ((dwData1 & dwData2) | ((~dwData1) & dwData3)))));
iData[(16 - j) % 4] = dwData1 + ((dwTemp << valueS) | (dwTemp >>> (32 - valueS)));
valueK = valueK + stepK;
j++;
}
i++;
}
iDataResult[0] = iDataResult[0] + iData[0];
iDataResult[1] = iDataResult[1] + iData[1];
iDataResult[2] = iDataResult[2] + iData[2];
iDataResult[3] = iDataResult[3] + iData[3];
return(hex128(iDataResult));
}
function getCodeArray(strWord) {
var arrayResult = new Array();
var strKey = escape(strWord);
while (strKey.length > 0) {
if (strKey.substr(0, 1) == "%") {
arrayResult.push(parseInt("0x0" + strKey.substr(1, 2)));
strKey = strKey.substr(3);
} else {
arrayResult.push(strKey.charCodeAt(0));
strKey = strKey.substr(1);
}
}
return(arrayResult);
}
function hex128(inArray) {
var outArray = new Array(4);
var i = 0;
while (i < 4) {
outArray[0] = (outArray[0] << 8) | ((inArray[0] >>> (i * 8)) & 255);
outArray[1] = (outArray[1] << 8) | ((inArray[1] >>> (i * 8)) & 255);
outArray[2] = (outArray[2] << 8) | ((inArray[2] >>> (i * 8)) & 255);
outArray[3] = (outArray[3] << 8) | ((inArray[3] >>> (i * 8)) & 255);
i++;
}
var strResult = hex32(outArray[0]);
strResult = strResult + hex32(outArray[1]);
strResult = strResult + hex32(outArray[2]);
strResult = strResult + hex32(outArray[3]);
return(strResult);
}
function hex32(inValue) {
var strResult = (65536 | (inValue >>> 16)).toString(16).substr(1);
return(strResult + (65536 | (inValue & 65535)).toString(16).substr(1));
}
this.iTitle = 1;
_root.strVersion = "1.20";
Stage.showMenu = false;
this.stop();
Instance of Symbol 19 MovieClip "infoMap" in Frame 1
onClipEvent (load) {
function extractCourse() {
if (this.iProc != 1) {
return(undefined);
}
this.dProgress = (20 * iProcCourse) / infoTrack.length;
if (iProcCourse >= infoTrack.length) {
iProcCourse = 0;
iProc++;
return(undefined);
}
var infoBezier = ((!this.bReverse) ? (infoTrack[iProcCourse]) : (infoTrack[(infoTrack.length - 1) - iProcCourse].reverse()));
var t = 0;
while (t < 1) {
var iX = iOffsetX;
var iY = iOffsetY;
iX = iX + (((((1 - t) * (1 - t)) * (1 - t)) * infoBezier[0][0]) + ((((3 * t) * (1 - t)) * (1 - t)) * infoBezier[1][0]));
iX = iX + (((((3 * t) * t) * (1 - t)) * infoBezier[2][0]) + (((t * t) * t) * infoBezier[3][0]));
iY = iY + (((((1 - t) * (1 - t)) * (1 - t)) * infoBezier[0][1]) + ((((3 * t) * (1 - t)) * (1 - t)) * infoBezier[1][1]));
iY = iY + (((((3 * t) * t) * (1 - t)) * infoBezier[2][1]) + (((t * t) * t) * infoBezier[3][1]));
var dX = ((((-3 * (1 - t)) * (1 - t)) * infoBezier[0][0]) + ((3 * ((((3 * t) * t) - (4 * t)) + 1)) * infoBezier[1][0]));
dX = dX + (((3 * (((-3 * t) * t) + (2 * t))) * infoBezier[2][0]) + (((3 * t) * t) * infoBezier[3][0]));
var dY = ((((-3 * (1 - t)) * (1 - t)) * infoBezier[0][1]) + ((3 * ((((3 * t) * t) - (4 * t)) + 1)) * infoBezier[1][1]));
dY = dY + (((3 * (((-3 * t) * t) + (2 * t))) * infoBezier[2][1]) + (((3 * t) * t) * infoBezier[3][1]));
dLength = Math.sqrt((dX * dX) + (dY * dY));
t = t + Math.min(2 / dLength, 1 / iLength);
var iOption = 0;
if (((iProcCourse == (infoTrack.length - 1)) || ((iProcCourse % iFlagStep) == (iFlagStep - 1))) && (t >= 1)) {
iOption = 1;
}
infoCourse2D.push(new Array(iX * 200, iY * 200, iOption));
}
iProcCourse++;
}
function procCourse() {
if (iProc != 2) {
return(undefined);
}
this.dProgress = 20 + ((80 * iProcCourse) / infoCourse2D.length);
if (iProcCourse >= infoCourse2D.length) {
iProcCourse = 0;
iProc++;
return(undefined);
}
infoCurve.vecDirection = new Array(infoCourse2D[(iProcCourse + 1) % infoCourse2D.length][0] - infoCourse2D[iProcCourse][0], infoCourse2D[(iProcCourse + 1) % infoCourse2D.length][1] - infoCourse2D[iProcCourse][1], 0);
infoCurve.vecNextDirection = new Array(infoCourse2D[(iProcCourse + 2) % infoCourse2D.length][0] - infoCourse2D[(iProcCourse + 1) % infoCourse2D.length][0], infoCourse2D[(iProcCourse + 2) % infoCourse2D.length][1] - infoCourse2D[(iProcCourse + 1) % infoCourse2D.length][1], 0);
infoCurve.dBankAngle = 0;
infoCurve.dwFlags = infoCourse2D[iProcCourse][2];
addCurve(this.infoCourse3D, infoCurve, this.dMapScale);
iProcCourse++;
}
function addCurve(modelData, infoCurve, dMapScale) {
var model = new Object();
model.vecPosition = infoCurve.vecPosition.slice(0);
model.vecDirection = infoCurve.vecDirection.slice(0);
model.dBankAngle = infoCurve.dBankAngle;
model.dNextBankAngle = infoCurve.dNextBankAngle;
model.dNorm = Math.sqrt(((model.vecDirection[0] * model.vecDirection[0]) + (model.vecDirection[1] * model.vecDirection[1])) + (model.vecDirection[2] * model.vecDirection[2]));
this.dCourseLength = this.dCourseLength + model.dNorm;
model.vecNormal = new Array(model.vecDirection[0] / model.dNorm, model.vecDirection[1] / model.dNorm, model.vecDirection[2] / model.dNorm);
model.vecParallel = new Array(model.vecNormal[1] * Math.cos(model.dBankAngle), (-model.vecNormal[0]) * Math.cos(model.dBankAngle), -Math.sin(model.dBankAngle));
model.dOffset = -(((model.vecNormal[0] * model.vecPosition[0]) + (model.vecNormal[1] * model.vecPosition[1])) + (model.vecNormal[2] * model.vecPosition[2]));
model.dWidth = infoCurve.dWidth;
model.dNextWidth = infoCurve.dNextWidth;
model.vecNextNormal = infoCurve.vecNextDirection.slice(0);
var dNextNorm = Math.sqrt(((model.vecNextNormal[0] * model.vecNextNormal[0]) + (model.vecNextNormal[1] * model.vecNextNormal[1])) + (model.vecNextNormal[2] * model.vecNextNormal[2]));
model.vecNextNormal[0] = model.vecNextNormal[0] / dNextNorm;
model.vecNextNormal[1] = model.vecNextNormal[1] / dNextNorm;
model.vecNextNormal[2] = model.vecNextNormal[2] / dNextNorm;
model.vecNextParallel = new Array(model.vecNextNormal[1] * Math.cos(model.dNextBankAngle), (-model.vecNextNormal[0]) * Math.cos(model.dNextBankAngle), -Math.sin(model.dNextBankAngle));
model.typePrimitive = new Array(0, 0);
model.modelPrimitive = new Array(new Array(new Array(model.vecPosition[0] + (model.vecParallel[0] * model.dWidth), model.vecPosition[1] + (model.vecParallel[1] * model.dWidth), model.vecPosition[2] + (model.vecParallel[2] * model.dWidth)), new Array((model.vecPosition[0] + model.vecDirection[0]) + (model.vecNextParallel[0] * model.dNextWidth), (model.vecPosition[1] + model.vecDirection[1]) + (model.vecNextParallel[1] * model.dNextWidth), (model.vecPosition[2] + model.vecDirection[2]) + (model.vecNextParallel[2] * model.dNextWidth))), new Array(new Array(model.vecPosition[0] - (model.vecParallel[0] * model.dWidth), model.vecPosition[1] - (model.vecParallel[1] * model.dWidth), model.vecPosition[2] - (model.vecParallel[2] * model.dWidth)), new Array((model.vecPosition[0] + model.vecDirection[0]) - (model.vecNextParallel[0] * model.dNextWidth), (model.vecPosition[1] + model.vecDirection[1]) - (model.vecNextParallel[1] * model.dNextWidth), (model.vecPosition[2] + model.vecDirection[2]) - (model.vecNextParallel[2] * model.dNextWidth))));
model.iCheckIndex = 0;
if (infoCurve.dwFlags & 1) {
model.typePrimitive.push(0, 0, 0);
model.modelPrimitive.push(new Array(new Array(model.vecPosition[0] + ((model.vecParallel[0] * model.dWidth) * 2), model.vecPosition[1] + ((model.vecParallel[1] * model.dWidth) * 2), model.vecPosition[2] + ((model.vecParallel[2] * model.dWidth) * 2)), new Array(model.vecPosition[0] + ((model.vecParallel[0] * model.dWidth) * 2), model.vecPosition[1] + ((model.vecParallel[1] * model.dWidth) * 2), (model.vecPosition[2] + ((model.vecParallel[2] * model.dWidth) * 2)) + 150)), new Array(new Array(model.vecPosition[0] - ((model.vecParallel[0] * model.dWidth) * 2), model.vecPosition[1] - ((model.vecParallel[1] * model.dWidth) * 2), model.vecPosition[2] - ((model.vecParallel[2] * model.dWidth) * 2)), new Array(model.vecPosition[0] - ((model.vecParallel[0] * model.dWidth) * 2), model.vecPosition[1] - ((model.vecParallel[1] * model.dWidth) * 2), (model.vecPosition[2] - ((model.vecParallel[2] * model.dWidth) * 2)) + 150)), new Array(new Array(model.vecPosition[0] + ((model.vecParallel[0] * model.dWidth) * 2), model.vecPosition[1] + ((model.vecParallel[1] * model.dWidth) * 2), (model.vecPosition[2] + ((model.vecParallel[2] * model.dWidth) * 2)) + 125), new Array(model.vecPosition[0] - ((model.vecParallel[0] * model.dWidth) * 2), model.vecPosition[1] - ((model.vecParallel[1] * model.dWidth) * 2), (model.vecPosition[2] - ((model.vecParallel[2] * model.dWidth) * 2)) + 125)));
infoCurve.infoCheck.push(0);
var iCheckCount = infoCurve.infoCheck.length;
var strPointID = ("point" + iCheckCount);
_root.infoMap.infoPoint.attachMovie("POINT", strPointID, iCheckCount + 1);
_root.infoMap.infoPoint[strPointID]._x = dMapScale * infoCurve.vecPosition[0];
_root.infoMap.infoPoint[strPointID]._y = (-dMapScale) * infoCurve.vecPosition[1];
model.iCheckIndex = iCheckCount;
}
model.iIndex = infoCurve.iIndex;
modelData.push(model);
infoCurve.vecPosition[0] = infoCurve.vecPosition[0] + infoCurve.vecDirection[0];
infoCurve.vecPosition[1] = infoCurve.vecPosition[1] + infoCurve.vecDirection[1];
infoCurve.iIndex++;
}
function createSteering() {
this.infoSteering = new Array();
var i;
var j;
var dAngle;
i = 0;
while (i < this.infoCourse3D.length) {
j = (this.infoCourse3D.length - i) - 1;
var vecTarget = this.infoCourse3D[j].vecNormal;
dAngle = (360 - Math.round(57.2957795130823 * ((vecTarget[0] < 0) ? (Math.asin(vecTarget[1])) : (Math.PI - Math.asin(vecTarget[1]))))) % 360;
this.infoSteering[j] = new Array(dAngle, ((j == 0) ? 0 : (dAngle)), 0);
if (i > 0) {
this.infoSteering[j + 1][1] = this.infoSteering[j + 1][1] - this.infoSteering[j][0];
if (this.infoSteering[j + 1][1] < -180) {
this.infoSteering[j + 1][1] = this.infoSteering[j + 1][1] + 360;
}
if (this.infoSteering[j + 1][1] > 180) {
this.infoSteering[j + 1][1] = this.infoSteering[j + 1][1] - 360;
}
this.infoSteering[j][2] = (this.infoSteering[j + 1][1] + (this.infoSteering[j + 1][2] * 0.846481724890614)) / 1.84648172489061;
}
i++;
}
this.iProc++;
}
this.infoCourse2D = new Array();
this.infoCourse3D = new Array();
this.infoCheck = new Array();
this.dMapScale = 0.05;
this.bBusy = true;
this.iProc = 1;
this.iProcCourse = 0;
this.dProgress = 0;
this._visible = false;
infoCurve = new Object();
infoCurve.infoCheck = this.infoCheck;
infoCurve.vecPosition = new Array(0, 0, 0);
infoCurve.iIndex = 0;
infoCurve.dBankAngle = 0;
infoCurve.dNextBankAngle = 0;
infoCurve.dWidth = 150;
infoCurve.dNextWidth = 150;
this.iLength = 16;
this.bReverse = false;
infoTrack = new Array(new Array(new Array(143.073, 240.229), new Array(143.073, 240.229), new Array(182.257, 240.229), new Array(182.257, 240.229)), new Array(new Array(182.257, 240.229), new Array(189.045, 240.136), new Array(190.573, 226.105), new Array(190.573, 223.028)), new Array(new Array(190.573, 223.028), new Array(190.573, 218.604), new Array(188.161, 217.042), new Array(184.778, 214.672)), new Array(new Array(184.778, 214.672), new Array(182.17, 212.845), new Array(176.437, 218.997), new Array(172.251, 217.742)), new Array(new Array(172.251, 217.742), new Array(168.066, 216.486), new Array(168.664, 212.515), new Array(164.615, 209.677)), new Array(new Array(164.615, 209.677), new Array(158.134, 205.136), new Array(157.735, 214.51), new Array(150.733, 213.193)), new Array(new Array(150.733, 213.193), new Array(143.996, 211.926), new Array(145.175, 204.498), new Array(133.97, 205.497)), new Array(new Array(133.97, 205.497), new Array(126.608, 206.154), new Array(127.587, 219.207), new Array(118.525, 221.33)), new Array(new Array(118.525, 221.33), new Array(110.885, 223.12), new Array(97.153, 223.437), new Array(94.094, 225.162)), new Array(new Array(94.094, 225.162), new Array(92.548, 226.034), new Array(83.861, 235), new Array(82.462, 236.916)), new Array(new Array(82.462, 236.916), new Array(81.221, 238.615), new Array(80.641, 243.89), new Array(81.665, 244.785)), new Array(new Array(81.665, 244.785), new Array(87.376, 249.774), new Array(84.351, 253.534), new Array(80.266, 248.546)), new Array(new Array(80.266, 248.546), new Array(78.138, 245.946), new Array(73.307, 247.16), new Array(70.814, 248.125)), new Array(new Array(70.814, 248.125), new Array(66.174, 249.921), new Array(57.708, 258.894), new Array(52.066, 262.838)), new Array(new Array(52.066, 262.838), new Array(44.949, 267.812), new Array(39.278, 265.566), new Array(36.818, 261.42)), new Array(new Array(36.818, 261.42), new Array(33.599, 255.994), new Array(35.926, 248.347), new Array(47.621, 247.315)), new Array(new Array(47.621, 247.315), new Array(49.211, 247.174), new Array(59.691, 248.582), new Array(61.719, 247.976)), new Array(new Array(61.719, 247.976), new Array(63.874, 247.333), new Array(81.276, 232.628), new Array(82.197, 230.717)), new Array(new Array(82.197, 230.717), new Array(83.089, 228.867), new Array(91.489, 196.588), new Array(92.177, 195.507)), new Array(new Array(92.177, 195.507), new Array(93.5, 193.43), new Array(95.249, 190.155), new Array(97.817, 190.474)), new Array(new Array(97.817, 190.474), new Array(101.217, 190.895), new Array(103.064, 193.509), new Array(101.549, 197.574)), new Array(new Array(101.549, 197.574), new Array(99.966, 201.82), new Array(90.719, 200.509), new Array(92.552, 208.043)), new Array(new Array(92.552, 208.043), new Array(93.32, 211.199), new Array(100.202, 228.092), new Array(101.289, 229.76)), new Array(new Array(101.289, 229.76), new Array(102.241, 231.223), new Array(105.364, 228.717), new Array(106.687, 230.585)), new Array(new Array(106.687, 230.585), new Array(107.958, 232.379), new Array(112.179, 240.229), new Array(114.851, 240.229)), new Array(new Array(114.851, 240.229), new Array(114.851, 240.229), new Array(136.074, 240.229), new Array(136.074, 240.229)), new Array(new Array(136.074, 240.229), new Array(136.074, 240.229), new Array(143.073, 240.229), new Array(143.073, 240.229)));
this.iOffsetX = -infoTrack[0][0][0];
this.iOffsetY = -infoTrack[0][0][1];
this.iFlagStep = Math.ceil(infoTrack.length / 2);
this.dCourseLength = 0;
}
onClipEvent (enterFrame) {
if (this.iProc == 0) {
return(undefined);
}
if (this.iProc == 1) {
extractCourse();
return(undefined);
}
if (this.iProc == 2) {
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
procCourse();
return(undefined);
}
if (this.iProc == 3) {
createSteering();
}
if (this.iProc == 4) {
this.iProc = 0;
}
}
Instance of Symbol 22 MovieClip in Frame 1
onClipEvent (load) {
function checkKey(strKey) {
var infoKey = strKey.split("-");
infoKey.push(_root.getDigest(_root.createSeed((infoKey[0].substr(16, 16) + infoKey[0].substr(0, 16)) + getServerName())));
return(infoKey[1] == infoKey[2]);
}
function getServerName() {
return(_root._url.split("/").slice(2).shift());
}
this.iProc = 10;
this.iStartTime = getTimer();
_root.strServerHash = _root.getDigest(_root.createSeed(getServerName()));
_root.bOfficial = _root.strServerHash == "fa9452932c6a7687efc15abbe96c91fb";
_root.bOfficial = _root.bOfficial | ((_root.strServerHash == "421aa90e079fa326b6494f812ad13e79") & (_root.dummy.length > 0));
_root.PARAM_KEY = "";
if (_root.bOfficial) {
fscommand ("key");
}
}
onClipEvent (enterFrame) {
this._alpha = Math.min(Math.max(0, 50 + (80 * Math.sin(((getTimer() - this.iStartTime) * Math.PI) / 500))), 100);
if (this.iProc == 10) {
if ((getTimer() - this.iStartTime) < 2000) {
return(undefined);
}
if (_root._framesloaded < _root._totalframes) {
return(undefined);
}
this.iProc = 20;
this.gotoAndStop(2);
this.iStartTime = getTimer();
}
if (this.iProc == 20) {
if (_root.infoMap.iProc != 0) {
return(undefined);
}
}
_root.strKey = (checkKey(_root.PARAM_KEY) ? (_root.PARAM_KEY) : "");
_root.iPlayCounter = 0;
if (_root.iTitle == -1) {
_root.gotoAndPlay("EXIT");
}
if (_root.iTitle == 0) {
_root.gotoAndPlay("SELECT");
}
_root.gotoAndPlay("TITLE");
}
Frame 5
infoMap._visible = false;
this.stop();
Instance of Symbol 25 MovieClip "infoSound" in Frame 5
onClipEvent (load) {
function startSoundFX(strSound) {
if (!bLocal) {
fscommand ("sound", strSound);
} else {
trace(infoProcess.PARAM_COMMAND);
infoProcess.PARAM_COMMAND = strSound;
}
}
this.bLocal = false;
}
Frame 8
infoMap._visible = false;
_root.iPlayCounter++;
this.stop();
Instance of Symbol 102 MovieClip in Frame 8
onClipEvent (load) {
function clickOK() {
_quality = "MEDIUM";
_root.infoSound.startSoundFX(91);
_root.gotoAndPlay("START");
}
function clickMode(iSelect) {
_root.iMode = iSelect;
infoArrow._y = -64 + (_root.iMode * 32);
}
function clickSteering(iSelect) {
_root.iSteering = iSelect;
i = 0;
while (i < 5) {
this["infoSteering" + i].gotoAndStop(((_root.iSteering >= i) ? 1 : 2));
i++;
}
}
function clickExit() {
_root.infoSound.startSoundFX(90);
_root.iTitle = 1;
_root.gotoAndStop("TITLE");
}
this._alpha = 0;
this.iProc = 10;
this.iOffsetTime = getTimer();
if (typeof(_root.iMode) == "undefined") {
_root.iMode = 0;
_root.iSteering = 2;
}
clickSteering(_root.iSteering);
clickMode(_root.iMode);
}
onClipEvent (enterFrame) {
if (this.iProc == 0) {
return(undefined);
}
if (this.iProc == 10) {
if ((getTimer() - this.iOffsetTime) < 1000) {
return(undefined);
}
this.iProc++;
this.iOffsetTime = getTimer();
_root.infoSound.startSoundFX("90:12");
return(undefined);
}
if (this.iProc == 11) {
var dProc0 = ((getTimer() - this.iOffsetTime) / 1000);
var dProc1 = Math.max(0, Math.min(1, dProc0));
this._alpha = dProc1 * 100;
if (dProc0 > 1) {
this.iProc = 0;
}
}
}
Instance of Symbol 106 MovieClip "viewport" in Frame 10
onClipEvent (load) {
function initGame() {
this.dAngleTheta = 90;
this.dAnglePhi = 180;
this.vectorView = new Array(0, ((_root.iMode == 2) ? 75 : 0), 60);
this.dSpeed = 0;
this.dAccel = 0;
this.dCanto = 0;
this.iDirt = 0;
this.iSection = 0;
this.iMaxSection = 0;
this.iPrevCheckIndex = 0;
this.iLapCount = 0;
this.iPrevLapCount = 0;
i = 0;
while (i < this.infoCheck.length) {
this.infoCheck[i] = 0;
i++;
}
var iCarZ = 0;
_parent.infoCar._x = this._x;
_parent.infoCar._y = this._y + ((this.vectorView[2] * this.dZoom) / (iCarZ + this.dOffsetZ));
_parent.infoCar.iDefaultY = _parent.infoCar._y;
_parent.infoCar._xscale = (24 * this.dZoom) / (iCarZ + this.dOffsetZ);
_parent.infoCar._yscale = _parent.infoCar._xscale;
this.iPosition = 9;
this.dSteering = 1 / (10 + (_root.iSteering * 4));
}
function startGame() {
initGame();
this.iProc = this.iDefaultProc;
}
function endGame(iResult) {
this.iProc = ((iResult == 0) ? 10 : (20 + iResult));
this.bMove = false;
}
function perspective(vectorA, vectorV, vectorE) {
return((((vectorA[0] - vectorV[0]) * vectorE[0]) + ((vectorA[1] - vectorV[1]) * vectorE[1])) + ((vectorA[2] - vectorV[2]) * vectorE[2]));
}
function drawModel(modelData, vectorView, dAnglePhi, dAngleTheta) {
this.vectorEx = new Array(-Math.sin((dAnglePhi * Math.PI) / 180), Math.cos((dAnglePhi * Math.PI) / 180), 0);
this.vectorEy = new Array((-Math.cos((dAngleTheta * Math.PI) / 180)) * Math.cos((dAnglePhi * Math.PI) / 180), (-Math.cos((dAngleTheta * Math.PI) / 180)) * Math.sin((dAnglePhi * Math.PI) / 180), Math.sin((dAngleTheta * Math.PI) / 180));
this.vectorEz = new Array((-Math.sin((dAngleTheta * Math.PI) / 180)) * Math.cos((dAnglePhi * Math.PI) / 180), (-Math.sin((dAngleTheta * Math.PI) / 180)) * Math.sin((dAnglePhi * Math.PI) / 180), -Math.cos((dAngleTheta * Math.PI) / 180));
var iCourseLength = modelData.length;
this.clear();
var iNormalizedIndex = ((iSection + iCourseLength) % iCourseLength);
var dParam0 = ((((vectorView[0] * modelData[iNormalizedIndex].vecNormal[0]) + (vectorView[1] * modelData[iNormalizedIndex].vecNormal[1])) + (vectorView[2] * modelData[iNormalizedIndex].vecNormal[2])) + modelData[iNormalizedIndex].dOffset);
if (dParam0 < 0) {
this.iSection = this.iSection - 1;
iNormalizedIndex = (iSection + iCourseLength) % iCourseLength;
if (this.iSection < (this.iMaxSection - iCourseLength)) {
_root.infoControl.retireRace(0);
}
}
var iNormalizedNextIndex = (((iSection + iCourseLength) + 1) % iCourseLength);
var dParam1 = ((((vectorView[0] * modelData[iNormalizedNextIndex].vecNormal[0]) + (vectorView[1] * modelData[iNormalizedNextIndex].vecNormal[1])) + (vectorView[2] * modelData[iNormalizedNextIndex].vecNormal[2])) + modelData[iNormalizedNextIndex].dOffset);
if (dParam1 > 0) {
this.iSection = this.iSection + 1;
iNormalizedIndex = (iSection + iCourseLength) % iCourseLength;
iNormalizedNextIndex = ((iSection + iCourseLength) + 1) % iCourseLength;
this.iMaxSection = Math.min(Math.max(this.iMaxSection, this.iSection), iCourseLength * _root.infoControl.iLapMax);
this.iLapCount = Math.floor(this.iMaxSection / iCourseLength);
if (this.iLapCount > this.iPrevLapCount) {
_root.infoControl.storeLapTime(this.iLapCount);
this.iPrevLapCount = this.iLapCount;
}
if (modelData[iNormalizedIndex].iCheckIndex) {
if ((this.infoCheck[modelData[iNormalizedIndex].iCheckIndex - 1] == this.iLapCount) && (this.iMaxSection > this.iPrevCheckIndex)) {
this.infoCheck[modelData[iNormalizedIndex].iCheckIndex - 1]++;
var iSound = ((modelData[iNormalizedIndex].iCheckIndex == 2) ? 22 : 21);
if (((this.iLapCount + 1) != _root.infoControl.iLapMax) || (iSound != 22)) {
_root.infoSound.startSoundFX("90:61:" + iSound);
}
_root.infoControl.extendTime(15000);
if (this.iProc == 21) {
this.iProc = this.iDefaultProc;
}
this.iPrevCheckIndex = this.iMaxSection;
}
}
}
this.vecDisplace = new Array((((vectorView[0] - modelData[iNormalizedIndex].vecPosition[0]) * modelData[iNormalizedIndex].vecParallel[0]) + ((vectorView[1] - modelData[iNormalizedIndex].vecPosition[1]) * modelData[iNormalizedIndex].vecParallel[1])) + ((vectorView[2] - modelData[iNormalizedIndex].vecPosition[2]) * modelData[iNormalizedIndex].vecParallel[2]), (((vectorView[0] - modelData[iNormalizedIndex].vecPosition[0]) * modelData[iNormalizedIndex].vecNormal[0]) + ((vectorView[1] - modelData[iNormalizedIndex].vecPosition[1]) * modelData[iNormalizedIndex].vecNormal[1])) + ((vectorView[2] - modelData[iNormalizedIndex].vecPosition[2]) * modelData[iNormalizedIndex].vecNormal[2]));
this.dProgress = vecDisplace[1] / modelData[iNormalizedIndex].dNorm;
this.dWidth = (modelData[iNormalizedIndex].dWidth * (1 - dProgress)) + (modelData[iNormalizedIndex].dNextWidth * dProgress);
this.iDirt = ((Math.abs(vecDisplace[0]) > dWidth) ? 8 : 0);
if (Math.abs(vecDisplace[0]) > (dWidth * 5)) {
_root.infoControl.retireRace(0);
}
_root.infoCar._y = (_parent.infoCar.iDefaultY + (dDisplaceEx * Math.sin(this.dCanto))) + (((iDirt == 8) && (this.dSpeed > 0)) ? ((Math.random() * 2) - 1) : 0);
var x0;
var x1;
var y0;
var y1;
var z0;
var z1;
var scrX0;
var scrX1;
var scrY0;
var scrY1;
var zDiv;
var itemModel;
iModelRaw = (iSection + iCourseLength) - 12;
while (iModelRaw < ((iSection + iCourseLength) + 12)) {
itemModel = modelData[iModelRaw % iCourseLength];
i = 0;
while (i < itemModel.modelPrimitive.length) {
if (itemModel.typePrimitive[i] == 0) {
z0 = (((itemModel.modelPrimitive[i][0][0] - vectorView[0]) * vectorEz[0]) + ((itemModel.modelPrimitive[i][0][1] - vectorView[1]) * vectorEz[1])) + ((itemModel.modelPrimitive[i][0][2] - vectorView[2]) * vectorEz[2]);
z1 = (((itemModel.modelPrimitive[i][1][0] - vectorView[0]) * vectorEz[0]) + ((itemModel.modelPrimitive[i][1][1] - vectorView[1]) * vectorEz[1])) + ((itemModel.modelPrimitive[i][1][2] - vectorView[2]) * vectorEz[2]);
if ((z1 <= 0) && (z0 <= 0)) {
} else if ((z1 >= dFarZ) && (z0 >= dFarZ)) {
} else {
x0 = (((itemModel.modelPrimitive[i][0][0] - vectorView[0]) * vectorEx[0]) + ((itemModel.modelPrimitive[i][0][1] - vectorView[1]) * vectorEx[1])) + ((itemModel.modelPrimitive[i][0][2] - vectorView[2]) * vectorEx[2]);
x1 = (((itemModel.modelPrimitive[i][1][0] - vectorView[0]) * vectorEx[0]) + ((itemModel.modelPrimitive[i][1][1] - vectorView[1]) * vectorEx[1])) + ((itemModel.modelPrimitive[i][1][2] - vectorView[2]) * vectorEx[2]);
y0 = (((itemModel.modelPrimitive[i][0][0] - vectorView[0]) * vectorEy[0]) + ((itemModel.modelPrimitive[i][0][1] - vectorView[1]) * vectorEy[1])) + ((itemModel.modelPrimitive[i][0][2] - vectorView[2]) * vectorEy[2]);
y1 = (((itemModel.modelPrimitive[i][1][0] - vectorView[0]) * vectorEy[0]) + ((itemModel.modelPrimitive[i][1][1] - vectorView[1]) * vectorEy[1])) + ((itemModel.modelPrimitive[i][1][2] - vectorView[2]) * vectorEy[2]);
if (z0 <= 0) {
zDiv = z1 / (z1 - z0);
x0 = (x1 * (1 - zDiv)) + (x0 * zDiv);
y0 = (y1 * (1 - zDiv)) + (y0 * zDiv);
z0 = 0;
}
if (z1 <= 0) {
zDiv = z0 / (z0 - z1);
x1 = (x0 * (1 - zDiv)) + (x1 * zDiv);
y1 = (y0 * (1 - zDiv)) + (y1 * zDiv);
z1 = 0;
}
scrX0 = (dZoom * x0) / (z0 + dOffsetZ);
scrY0 = ((-dZoom) * y0) / (z0 + dOffsetZ);
scrX1 = (dZoom * x1) / (z1 + dOffsetZ);
scrY1 = ((-dZoom) * y1) / (z1 + dOffsetZ);
if ((Math.abs(scrX0) > 320) && (Math.abs(scrX1) > 320)) {
} else if ((Math.abs(scrY0) > 320) && (Math.abs(scrY1) > 320)) {
} else {
lineStyle(3, infoColor[parseInt(255 * Math.exp((-(z0 + z1)) / 1500))]);
moveTo(scrX0, scrY0);
lineTo(scrX1, scrY1);
}
}
}
i++;
}
iModelRaw++;
}
if (_root.iMode != 2) {
return(undefined);
}
var infoMachine;
var dScale;
var dDeltaCross;
this.iPosition = 1;
i = 0;
while (i < this.infoMachines.length) {
infoMachine = this.infoMachines[i];
iNormalizedNextIndex = (infoMachine.iSection + 1) % iCourseLength;
infoMachine.dParam1 = (((infoMachine.vectorPos[0] * modelData[iNormalizedNextIndex].vecNormal[0]) + (infoMachine.vectorPos[1] * modelData[iNormalizedNextIndex].vecNormal[1])) + (infoMachine.vectorPos[2] * modelData[iNormalizedNextIndex].vecNormal[2])) + modelData[iNormalizedNextIndex].dOffset;
infoMachine.iSection = infoMachine.iSection + ((infoMachine.dParam1 > 0) ? 1 : 0);
iNormalizedIndex = infoMachine.iSection % iCourseLength;
infoMachine.vecDisplace = new Array((((infoMachine.vectorPos[0] - modelData[iNormalizedIndex].vecPosition[0]) * modelData[iNormalizedIndex].vecParallel[0]) + ((infoMachine.vectorPos[1] - modelData[iNormalizedIndex].vecPosition[1]) * modelData[iNormalizedIndex].vecParallel[1])) + ((infoMachine.vectorPos[2] - modelData[iNormalizedIndex].vecPosition[2]) * modelData[iNormalizedIndex].vecParallel[2]), (((infoMachine.vectorPos[0] - modelData[iNormalizedIndex].vecPosition[0]) * modelData[iNormalizedIndex].vecNormal[0]) + ((infoMachine.vectorPos[1] - modelData[iNormalizedIndex].vecPosition[1]) * modelData[iNormalizedIndex].vecNormal[1])) + ((infoMachine.vectorPos[2] - modelData[iNormalizedIndex].vecPosition[2]) * modelData[iNormalizedIndex].vecNormal[2]));
bFast = (infoMachine.iSection + (infoMachine.vecDisplace[1] / modelData[iNormalizedIndex].dNorm)) > (this.iMaxSection + dProgress);
iPosition = iPosition + (bFast ? 1 : 0);
dNear = (((vectorView[0] - infoMachine.vectorPos[0]) * (vectorView[0] - infoMachine.vectorPos[0])) + ((vectorView[1] - infoMachine.vectorPos[1]) * (vectorView[1] - infoMachine.vectorPos[1]))) + ((vectorView[2] - infoMachine.vectorPos[2]) * (vectorView[2] - infoMachine.vectorPos[2]));
if (dNear < 5625) {
if (bFast) {
this.iDirt = 2;
} else {
infoMachine.bDirt = true;
}
}
dDeltaCross = _root.infoMap.infoSteering[iNormalizedIndex][0] - infoMachine.dAngle;
if (dDeltaCross > 180) {
dDeltaCross = dDeltaCross - 360;
}
if (dDeltaCross < -180) {
dDeltaCross = dDeltaCross + 360;
}
dDeltaCross = dDeltaCross + (2.2 * _root.infoMap.infoSteering[iNormalizedIndex][2]);
dDeltaAngle = (-0.171875 * dDeltaCross) - (2.25 * Math.pow(infoMachine.vecDisplace[0] / 120, 3));
dDeltaAngle = dDeltaAngle * ((2 / ((infoMachine.dSpeed / 100) + 1)) * ((Math.random() * 0.02) + 0.99));
infoMachine.dAngle = infoMachine.dAngle - (((dDeltaAngle * infoMachine.dSpeed) * this.dCoefTime) / 50);
infoMachine.dSpeed = infoMachine.dSpeed + (((this.iProc < 20) ? (infoMachine.dAccel) : 0) - (infoMachine.dSpeed * ((infoMachine.bDirt ? 0.2 : 0.049) + (Math.abs(dDeltaAngle) / 48))));
infoMachine.vectorPos[0] = infoMachine.vectorPos[0] - ((this.dCoefTime * infoMachine.dSpeed) * Math.cos((infoMachine.dAngle * Math.PI) / 180));
infoMachine.vectorPos[1] = infoMachine.vectorPos[1] - ((this.dCoefTime * infoMachine.dSpeed) * Math.sin((infoMachine.dAngle * Math.PI) / 180));
infoMachine.infoMC._visible = (infoMachine.iSection > (iSection - 12)) && (infoMachine.iSection < (iSection + 12));
if (!infoMachine.infoMC._visible) {
} else {
z0 = perspective(infoMachine.vectorPos, vectorView, vectorEz);
if ((z0 < (-dOffsetZ)) || (z0 > dFarZ)) {
infoMachine.infoMC._visible = false;
} else {
x0 = perspective(infoMachine.vectorPos, vectorView, vectorEx);
y0 = perspective(infoMachine.vectorPos, vectorView, vectorEy);
dScale = this.dZoom / (z0 + this.dOffsetZ);
infoMachine.infoMC._x = x0 * dScale;
infoMachine.infoMC._y = (-y0) * dScale;
infoMachine.infoMC._xscale = 30 * dScale;
infoMachine.infoMC._yscale = infoMachine.infoMC._xscale;
}
}
i++;
}
_root.infoControl.strPosition = (("POSITION : " + this.iPosition) + " / ") + (infoMachines.length + 1);
}
this.iDefaultProc = 0;
this.iProc = 20;
this.dOffsetZ = 75;
this.dFarZ = dOffsetZ * 24;
this.dZoom = 225;
this.infoModel3D = _root.infoMap.infoCourse3D;
this.infoCheck = _root.infoMap.infoCheck;
this.infoMachines = new Array();
i = 0;
while (i < 8) {
_parent.infoMachines.attachMovie("car", "car" + i, i + 1);
_parent.infoMachines["car" + i]._visible = false;
var infoMachine = new Object();
infoMachine.vectorPos = new Array((150 * i) + 150, (150 * (i % 2)) - 75, 0);
infoMachine.infoMC = _parent.infoMachines["car" + i];
infoMachine.dSpeed = 0;
infoMachine.dAngle = 180;
infoMachine.iSection = 0;
infoMachine.dAccel = 4.15 + (0.1 * i);
this.infoMachines.push(infoMachine);
i++;
}
initGame();
var infoColor = new Array(256);
i = 0;
while (i < 256) {
infoColor[i] = (255 - i) * 65793;
i++;
}
}
onClipEvent (mouseDown) {
if (this.iProc != 0) {
return(undefined);
}
this.bMove = true;
}
onClipEvent (mouseUp) {
if (this.iProc != 0) {
return(undefined);
}
this.bMove = false;
}
onClipEvent (enterFrame) {
this.dwPrevTime = this.dwTime;
this.dwTime = getTimer();
if (this.iProc < 30) {
this.dCoefTime = (this.dwTime - this.dwPrevTime) / 55;
if (this.iProc == 10) {
this.bMove = true;
var dDeltaCross = (_root.infoMap.infoSteering[iSection % this.infoModel3D.length][0] - this.dAnglePhi);
if (dDeltaCross > 180) {
dDeltaCross = dDeltaCross - 360;
}
if (dDeltaCross < -180) {
dDeltaCross = dDeltaCross + 360;
}
dDeltaCross = dDeltaCross + (2.2 * _root.infoMap.infoSteering[iSection % this.infoModel3D.length][2]);
var dWeightCross = 3.2;
dAutoDeltaPhi = (-0.55 * dDeltaCross) / dWeightCross;
dAutoDeltaPhi = dAutoDeltaPhi - (2.25 * (((((this.vecDisplace[0] * this.vecDisplace[0]) * this.vecDisplace[0]) / 120) / 120) / 120));
dAutoDeltaPhi = dAutoDeltaPhi * (2 / ((this.dSpeed / 100) + 1));
}
var dDeltaPhi = ((iProc == 0) ? (this._xmouse * this.dSteering) : (dAutoDeltaPhi));
var dAccel = (this.bMove ? 5 : 0);
this.dSpeed = this.dSpeed + (dAccel - (this.dSpeed * (((this.iDirt * 0.025) + 0.049) + (Math.abs(dDeltaPhi) / 48))));
if (this.dSpeed < 1) {
this.dSpeed = 0;
}
_root.infoControl.infoSpeed._yscale = this.dSpeed;
_root.infoControl.strSpeed = parseInt(this.dSpeed * 3) + "km/h";
var dRealSpeed = (this.dSpeed * this.dCoefTime);
this.vectorView[0] = this.vectorView[0] + ((-dRealSpeed) * Math.cos((this.dAnglePhi * Math.PI) / 180));
this.vectorView[1] = this.vectorView[1] + ((-dRealSpeed) * Math.sin((this.dAnglePhi * Math.PI) / 180));
_root.infoMap.infoPosition._x = _root.infoMap.dMapScale * this.vectorView[0];
_root.infoMap.infoPosition._y = (-_root.infoMap.dMapScale) * this.vectorView[1];
_root.infoCar.infoMona._rotation = ((this.dSpeed * dDeltaPhi) * (0.5 + (0.5 * Math.random()))) * 0.05;
_root.infoCar.infoTireFL._rotation = dDeltaPhi;
_root.infoCar.infoTireFR._rotation = _root.infoCar.infoTireFL._rotation;
_root.infoCar.infoTireRL.infoGlow._y = Math.sin(((Math.PI * this.dwTime) * this.dSpeed) * 1E-5);
_root.infoCar.infoTireRR.infoGlow._y = _root.infoCar.infoTireRL.infoGlow._y;
drawModel(this.infoModel3D, this.vectorView, this.dAnglePhi, this.dAngleTheta);
this.dAnglePhi = this.dAnglePhi - ((dDeltaPhi * dRealSpeed) / 50);
}
}
Instance of Symbol 125 MovieClip "infoControl" in Frame 10
onClipEvent (load) {
function startRace() {
this.iLapMax = ((_root.iMode == 0) ? 1 : 3);
this.iStartTime = getTimer();
this.dwDefaultTime = 160000 /* 0x027100 */;
this.dwStartTime = 0;
this.infoLapTime = new Array();
this.strRecode = "";
this.dwRestTime = this.dwDefaultTime;
this.iProc = 40;
this.iResult = 0;
this.strLap = "LAP : 1 / " + this.iLapMax;
this.strPosition = ((_root.iMode == 2) ? "POSITION : 9 / 9" : "");
this.gotoAndStop("SIGNAL_OFF");
}
function reachGoal() {
this.iProc = 80;
this.iStartTime = getTimer();
infoMessage.gotoAndPlay("GOAL");
this.iResult = 0;
_root.viewport.endGame(0);
_root.infoSound.startSoundFX(((_root.iMode != 0) ? "90:50:25:10" : "91:50:25"));
}
function retireRace(iCause) {
if (this.iProc != 10) {
return(undefined);
}
this.iProc = 90 + ((iCause == 1) ? 0 : 1);
this.iStartTime = getTimer();
infoMessage.gotoAndPlay(((iCause == 1) ? "TIMEUP" : "RETIRE"));
this.iResult = ((iCause == 1) ? 1 : 2);
_root.viewport.endGame(this.iResult);
}
function extendTime(dwDeltaTime) {
if (this.iProc == 90) {
this.iProc = 10;
}
if (this.iProc != 10) {
return(undefined);
}
this.dwDefaultTime = this.dwDefaultTime + dwDeltaTime;
infoMessage.gotoAndPlay("TIMEEXTENSION");
infoMessage.strLapTime = "";
}
function storeLapTime(iLapCount) {
if (iLapCount < (this.iLapMax - 1)) {
this.strLap = (("LAP : " + (1 + iLapCount)) + " / ") + this.iLapMax;
} else {
this.strLap = "FINAL LAP";
}
infoLapTime.unshift(getTimer() - this.dwStartTime);
var dwLapTime = infoLapTime[0];
if (infoLapTime.length > 1) {
dwLapTime = dwLapTime - infoLapTime[1];
}
var strTempTime = ((parseInt(dwLapTime / 1000) + ".") + (1000 + (dwLapTime % 1000)).toString().substr(1));
infoMessage.strLapTime = "Lap time : " + strTempTime;
this.strRecode = this.strRecode + (((iLapCount + " : ") + strTempTime) + newline);
if (iLapCount >= this.iLapMax) {
reachGoal("GOAL");
}
}
this.iProc = 0;
}
onClipEvent (enterFrame) {
if (this.iProc == 0) {
return(undefined);
}
if (this.iProc == 10) {
this.dwRestTime = this.dwDefaultTime - (getTimer() - this.dwStartTime);
if (dwRestTime < 0) {
dwRestTime = 0;
retireRace(1);
}
}
this.strRestTime = (("TIME : " + parseInt(dwRestTime / 1000)) + ".") + (1000 + (dwRestTime % 1000)).toString().substr(1);
if (this.iProc < 40) {
return(undefined);
}
var iDeltaTime = (getTimer() - this.iStartTime);
if ((this.iProc == 40) && (iDeltaTime > 2250)) {
_root.infoSound.startSoundFX("90:50:23");
this.iProc++;
return(undefined);
}
if ((this.iProc == 41) && (iDeltaTime > 3000)) {
this.gotoAndStop("SIGNAL_READY");
this.iProc++;
return(undefined);
}
if ((this.iProc == 42) && (iDeltaTime > 4750)) {
_root.infoSound.startSoundFX("61:24");
this.iProc++;
return(undefined);
}
if ((this.iProc == 43) && (iDeltaTime > 5000)) {
this.dwStartTime = getTimer();
_root.viewport.startGame();
this.gotoAndStop("SIGNAL_START");
this.iProc++;
return(undefined);
}
if (this.iProc == 44) {
this.dwRestTime = this.dwDefaultTime - (getTimer() - this.dwStartTime);
if (iDeltaTime > 7000) {
this.gotoAndStop("IDLE");
this.iProc = 10;
}
return(undefined);
}
if ((this.iProc >= 80) && (iDeltaTime > 2000)) {
_root.gotoAndStop("EXIT");
this.iProc = 0;
return(undefined);
}
}
Frame 11
_root.infoMap._visible = true;
_root.infoControl.startRace();
Frame 12
this.stop();
Frame 13
prevFrame();
Instance of Symbol 162 MovieClip "infoResults" in Frame 14
onClipEvent (load) {
function testResult() {
var dwTime = 0;
var iTempLap = Math.floor(Math.random() * 3.999);
_root.infoControl.infoLapTime = new Array();
i = 0;
while (i < iTempLap) {
dwTime = dwTime + (((((75 + (Math.random() * 2)) + (Math.random() * 2)) + (Math.random() * 2)) - 3) * 1000);
_root.infoControl.infoLapTime.unshift(Math.floor(dwTime));
i++;
}
if (_root.infoControl.infoLapTime.length < _root.infoControl.iLapMax) {
_root.infoControl.dwRestTime = 0;
} else {
_root.infoControl.dwRestTime = Math.floor(240000 - dwTime);
}
}
function setResults(strRanking) {
if (_root.iTitle == -1) {
testResult();
}
this.dwScore = 0;
this.iBestLap = 240000 /* 0x03A980 */;
this.iTotalTime = 0;
this.iLapTimes = new Array();
this.iLapCount = 0;
var strIndent = " ";
var iTime;
var iPrevTime = 0;
var infoLapTime = _root.infoControl.infoLapTime.slice(0);
var iLapMax = _root.infoControl.iLapMax;
this.infoResultDisp.push("MONA CIRCUIT ver" + _root.strVersion);
if (_root.iMode == 0) {
this.infoResultDisp.push(strIndent + " PRACTICE MODE");
}
if (_root.iMode == 1) {
this.infoResultDisp.push(strIndent + " TIME TRIAL MODE");
}
while (infoLapTime.length) {
iTime = infoLapTime.pop();
this.iTotalTime = Math.max(this.iTotalTime, iTime);
this.iLapTimes.push(iTime - iPrevTime);
iBestLap = Math.min(iBestLap, iTime - iPrevTime);
iPrevTime = iTime;
}
this.iLapCount = this.iLapTimes.length;
this.dwScore = this.dwScore + Math.round((5000 * _root.viewport.iMaxSection) / _root.viewport.infoModel3D.length);
this.dwScore = this.dwScore + Math.max(0, Math.round((10000 - (iBestLap / 10)) * iLapCount));
if (this.iLapCount == iLapMax) {
this.dwScore = this.dwScore + Math.round(((_root.infoControl.dwRestTime / 10) * iLapCount) / iLapMax);
}
i = 0;
while (i < _root.infoControl.iLapMax) {
this.infoResultDisp.push((((strIndent + " LAP ") + (i + 1)) + " :") + ((i < iLapCount) ? (formatTime(this.iLapTimes[i])) : " --.---"));
i++;
}
if (iLapCount < iLapMax) {
this.infoResultDisp.push(strIndent + " TOTAL :RETIRED");
} else {
this.infoResultDisp.push((strIndent + " TOTAL :") + formatTime(this.iTotalTime));
}
this.infoResultDisp.push((strIndent + " REST :") + formatTime(_root.infoControl.dwRestTime));
if (_root.iMode == 2) {
var strOrder = "1st/2nd/3rd/4th/5th/6th/7th/8th/9th".split("/")[this.iPosition - 1];
this.infoResultDisp.push(((((((strIndent + "POSITION: ") + strOrder) + "(") + this.iPosition) + "/") + this.iMaxPosition) + ")");
dwScore = dwScore + Math.max(0, (7 - this.iPosition) * 200);
}
this.infoResultDisp.push((strIndent + " SCORE :") + formatScore(dwScore));
if (_root.iMode != 0) {
this.infoResultDisp.push((strIndent + " RANKING: ") + (strRanking.length ? (strRanking) : "---/---"));
}
}
function createData() {
var infoDataArray = new Array();
infoDataArray.push(new Array(4096, this.dwScore), new Array(4112, this.iPosition), new Array(4352, this.iLapCount), new Array(4608, this.iTotalTime), new Array(4624, this.iBestLap), new Array(4736, this.iLapTimes[0]), new Array(4752, this.iLapTimes[1]), new Array(4768, this.iLapTimes[2]));
infoDataArray.push(new Array(4097, this.dwScore), new Array(4113, this.iPosition), new Array(4353, this.iLapCount), new Array(4609, this.iTotalTime), new Array(4625, this.iBestLap), new Array(4737, this.iLapTimes[0]), new Array(4753, this.iLapTimes[1]), new Array(4769, this.iLapTimes[2]));
var strData = "";
for (i in infoDataArray) {
var strSeed = ((Math.random() * 65535).toString() + (Math.random() * 65535).toString());
var strKey = _root.getDigest(_root.createSeed(strSeed)).substr(0, 4);
var strHash = _root.getDigest(_root.createSeed((strKey + _root.strKey.split("-").shift()) + _root.hex32(_root.iPlayCounter)));
strData = strData + (strKey + ((infoDataArray[i][0] ^ parseInt(strHash.substr(8, 4), 16)) + 65536).toString(16).substr(1));
strData = strData + _root.hex32(infoDataArray[i][1] ^ parseInt(strHash.substr(16, 8), 16));
}
return(strData);
}
function createKey(strKey) {
var strKey = strKey.split("-").shift();
var strSeed = ((strKey.substr(0, 11) + _root.iPlayCounter.toString()) + strKey.substr(11));
var strTempKey = _root.getDigest(_root.createSeed(strSeed)).substr(0, 8);
var strHash = _root.getDigest(_root.createSeed(strTempKey + strKey));
strKey = strKey + ("-" + strTempKey);
strKey = strKey + ((_root.iPlayCounter ^ parseInt(strHash.substr(0, 4), 16)) + 65536).toString(16).substr(1);
strKey = strKey + ((_root.iPlayCounter ^ parseInt(strHash.substr(8, 4), 16)) + 65536).toString(16).substr(1);
var strExtra = ((Math.random() * 65535).toString() + (Math.random() * 65535).toString());
strKey = strKey + ("/" + _root.getDigest(_root.createSeed(strExtra)).substr(0, 8));
return(strKey);
}
function sendResults() {
var infoSendXML = new XML();
var infoRootXML = new XML();
infoSendXML.xmlDecl = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
var infoRootNode = infoRootXML.createElement("circuit");
infoRootNode.attributes.name = this.strName;
infoRootNode.attributes.key = "";
infoRootNode.attributes.data = createData();
infoSendXML.appendChild(infoRootNode);
var strSendKey = this.createKey(_root.strKey);
this.infoResultXML = new XML();
infoResultXML.onLoad = function (bSuccess) {
_root.infoResults.parseResultXML((bSuccess ? (this) : null));
};
infoSendXML.sendAndLoad((this.strServerURL + "/") + strSendKey, this.infoResultXML);
this.infoRanking = new Object();
this.iWaitOffset = getTimer();
this.gotoAndStop("WAIT");
}
function procWait() {
var iWaitTime = (getTimer() - this.iWaitOffset);
if (iWaitTime < 3000) {
return(undefined);
}
if (iWaitTime > 30000) {
this.infoRanking.status = 1281;
}
if (!this.infoRanking.status) {
return(undefined);
}
if (this.infoRanking.status == 512) {
this.addRanking();
return(undefined);
}
this.strError = getErrorMessage(parseInt(this.infoRanking.status));
this.gotoAndStop("ERROR");
}
function addRanking() {
setResults(this.infoRanking.ranking);
this.strResult = this.infoResultDisp.join(newline);
this.gotoAndStop("RANKING");
this.infoRank._visible = true;
var infoTempRank = this.infoRanking.ranking.split("/");
var iRank = parseInt(infoTempRank[0]);
this.infoRank.strRankA = infoTempRank[0];
this.infoRank.strRankD = infoTempRank[1];
this.infoRank.strRankB = "th";
if (((iRank % 10) == 1) && ((iRank % 100) != 11)) {
this.infoRank.strRankB = "st";
}
if (((iRank % 10) == 2) && ((iRank % 100) != 12)) {
this.infoRank.strRankB = "nd";
}
if (((iRank % 10) == 3) && ((iRank % 100) != 13)) {
this.infoRank.strRankB = "rd";
}
this.iOffsetTime = getTimer();
this.iProc = 40;
}
function getErrorMessage(iErrorCode) {
var strRet = (("Error Code : " + iErrorCode.toString(16)) + newline);
if ((iErrorCode & 65280) == 1280) {
strRet = strRet + "SERVER BUSY\nPlease Retry Later.";
}
if ((iErrorCode & 65520) == 1024) {
strRet = strRet + "INVALID DATA";
}
if (iErrorCode == 1089) {
strRet = strRet + "NAME TOO LONG";
}
return(strRet);
}
function clickExitError() {
var iErrorCode = parseInt(this.infoRanking.status);
var bRetry = false;
bRetry = bRetry | ((iErrorCode & 65280) == 1280);
bRetry = bRetry | ((iErrorCode & 65520) == 1088);
this.gotoAndStop((bRetry ? "INPUT" : "EXIT"));
}
function clickRanking() {
if (_root.strKey.length > 0) {
this.gotoAndStop("INPUT");
}
}
function parseResultXML(infoXML) {
trace(infoXML.toString());
if (!infoXML) {
return(undefined);
}
procParseResultXML(infoXML);
}
function procParseResultXML(infoXML) {
var i;
if (infoXML.nodeType == 3) {
return(undefined);
}
var strNodeName = infoXML.nodeName.toLowerCase();
if (strNodeName == "circuit") {
for (i in infoXML.attributes) {
this.infoRanking[i] = infoXML.attributes[i];
}
}
for (i in infoXML.childNodes) {
procParseResultXML(infoXML.childNodes[i]);
}
}
function formatTime(dwTime) {
var strRet = Math.floor(dwTime / 1000).toString();
strRet = " ".substr(strRet.length) + strRet;
strRet = strRet + ("." + ((dwTime % 1000) + 1000).toString().substr(1));
return(strRet);
}
function formatScore(dwScore) {
var strRet = dwScore.toString();
strRet = " ".substr(strRet.length) + strRet;
return(strRet);
}
function clickExitResult() {
if (_root.iTitle == -1) {
this.setResults();
return(undefined);
}
if (_root.iMode != 0) {
_root.infoSound.startSoundFX(91);
}
_root.gotoAndStop("SELECT");
}
this.strServerURL = "ranking.php/entry";
_quality = _root.strDefaultQuality;
this.bFinished = _root.infoControl.iResult == 0;
if (!this.bFinished) {
_root.infoSound.startSoundFX("50:91");
}
this.iProc = 10;
this._alpha = 0;
this.infoChecker._visible = (_root.iMode != 0) && (this.bFinished);
this.infoRank._visible = false;
this.iMaxPosition = _root.viewport.infoMachines.length + 1;
this.iPosition = ((_root.iMode == 2) ? ((this.bFinished ? (_root.viewport.iPosition) : (iMaxPosition))) : 0);
this.infoResultDisp = new Array();
this.strResult = "";
if (((this.dwScore == 0) || (_root.strKey.length == 0)) || (_root.iMode == 0)) {
this.gotoAndStop("EXIT");
}
}
onClipEvent (enterFrame) {
if (this.iProc == 10) {
if (this._alpha < 100) {
this._alpha = Math.ceil(((this._alpha * 3) + 100) / 4);
return(undefined);
}
this.setResults(null);
this.iProc = 20;
this.iOffsetTime = getTimer();
_root.viewport.iProc = 40;
}
if ((this.iProc == 20) && ((getTimer() - this.iOffsetTime) > 150)) {
if (this.infoResultDisp.length) {
this.strResult = this.strResult + (this.infoResultDisp.shift() + newline);
this.iOffsetTime = getTimer();
return(undefined);
}
this.iProc = 30;
}
if (this.iProc == 40) {
var dProc0 = (((getTimer() - this.iOffsetTime) - 2000) / 100);
var dProc1 = Math.pow(Math.min(Math.max(0, dProc0), 1), 3);
this.infoRank._x = (73 * dProc1) + (229.6 * (1 - dProc1));
this.infoRank._y = (142.7 * dProc1) + (177.2 * (1 - dProc1));
this.infoRank._xscale = (40 * dProc1) + (100 * (1 - dProc1));
this.infoRank._yscale = this.infoRank._xscale;
if (dProc0 < 1) {
return(undefined);
}
this.iProc = 0;
this.gotoAndStop("EXIT");
}
}
Frame 16
this.stop();
Frame 17
prevFrame();
Symbol 22 MovieClip Frame 1
this.stop();
Symbol 36 Button
on (release) {
infoTitle.clickStart();
}
Symbol 40 Button
on (release) {
this.infoTitle.clickExit();
}
Instance of Symbol 60 MovieClip in Symbol 62 MovieClip Frame 1
onClipEvent (load) {
function resetPosition() {
this._y = 160;
this.iProc = 10;
}
function procScroll() {
if (this._y > -600) {
this._y = this._y - 2;
} else {
this.iProc = 20;
this.iTimeOffset = getTimer();
}
}
resetPosition();
}
onClipEvent (enterFrame) {
if (this.iProc == 10) {
procScroll();
}
if ((this.iProc == 20) && ((getTimer() - this.iTimeOffset) > 2000)) {
_root.infoSound.startSoundFX(91);
this.iProc = 0;
}
}
onClipEvent (mouseDown) {
if (this.iProc == 0) {
resetPosition();
}
}
Symbol 63 MovieClip Frame 1
this._visible = false;
this.gotoAndStop(3);
Instance of Symbol 27 MovieClip "infoTitle" in Symbol 63 MovieClip Frame 1
onClipEvent (load) {
function clickStart() {
_root.infoSound.startSoundFX(91);
_root.gotoAndStop("SELECT");
}
function clickExit() {
this.iProc = 0;
_parent.gotoAndStop("EXIT");
}
function initLogo() {
infoLogo._alpha = 0;
infoLogo.iDefaultY = infoLogo._y;
infoLogo._y = infoLogo._y - 20;
}
function initFlow() {
infoFlow._x = infoMachine.vecInfinite[0] - this._x;
infoFlow._y = infoMachine.vecInfinite[1] - this._y;
infoFlow.infoArrow = new Array();
infoFlow.dLength = 50;
infoFlow.dZoom = 100;
infoFlow.dOffset = 100;
infoFlow.dSpeed = 50;
infoFlow.dMaxOffset = 500;
infoFlow.iLineCount = 16;
i = 0;
while (i < infoFlow.iLineCount) {
var dAngle = ((Math.random() * Math.PI) * 2);
infoFlow.infoArrow.push(new Array(400 * Math.cos(dAngle), 400 * Math.sin(dAngle), (infoFlow.dMaxOffset * i) / infoFlow.iLineCount));
i++;
}
}
function initMachine() {
infoMachine._xscale = 0;
infoMachine._yscale = 0;
infoMachine.vecPosition = new Array(infoMachine._x, infoMachine._y, 40);
infoMachine.vecInfinite = new Array(infoMachine._x - 60, infoMachine._y - 80, 0);
infoMachine.iStartTime = getTimer();
infoMachine.iProc = 0;
infoMachine.iPrevTime = 0;
}
function drawFlow() {
infoFlow.clear();
infoFlow.lineStyle(4, 16777215, 100);
i = 0;
while (i < infoFlow.infoArrow.length) {
infoFlow.infoArrow[i][2] = infoFlow.infoArrow[i][2] + infoFlow.dSpeed;
if (infoFlow.infoArrow[i][2] > infoFlow.dMaxOffset) {
var dAngle = ((Math.random() * Math.PI) * 2);
infoFlow.infoArrow[i][0] = 400 * Math.cos(dAngle);
infoFlow.infoArrow[i][1] = 400 * Math.sin(dAngle);
infoFlow.infoArrow[i][2] = 0;
}
var dScale0 = (infoFlow.dZoom / (infoFlow.infoArrow[i][2] + infoFlow.dOffset));
var dScale1 = (infoFlow.dZoom / ((infoFlow.infoArrow[i][2] + infoFlow.dLength) + infoFlow.dOffset));
infoFlow.moveTo(infoFlow.infoArrow[i][0] * dScale0, infoFlow.infoArrow[i][1] * dScale0);
infoFlow.lineTo(infoFlow.infoArrow[i][0] * dScale1, infoFlow.infoArrow[i][1] * dScale1);
i++;
}
}
function moveLogo() {
if (infoMachine.iProc != 4) {
return(undefined);
}
if (infoLogo._alpha < 100) {
infoLogo._y = ((infoLogo._y * 7) + infoLogo.iDefaultY) / 8;
infoLogo._alpha = infoLogo._alpha + 4;
}
}
function procMachine() {
if (infoMachine.iProc == 0) {
if ((getTimer() - infoMachine.iStartTime) < 1000) {
return(undefined);
}
infoMachine.iProc++;
return(undefined);
}
if (infoMachine.iProc == 1) {
_root.infoSound.startSoundFX(((_root.iTitle == 1) ? "90:50:20" : "50:20"));
infoMachine.iPrevTime = getTimer();
infoMachine.iProc++;
return(undefined);
}
if (infoMachine.iProc == 2) {
if ((getTimer() - infoMachine.iStartTime) > 3000) {
if (_root.iTitle == 1) {
_root.infoSound.startSoundFX(10);
}
infoMachine.iProc++;
}
}
if (infoMachine.vecPosition[2] > 0) {
infoMachine.vecPosition[2] = infoMachine.vecPosition[2] - 1;
var dScale = (1 / ((4 * infoMachine.vecPosition[2]) + 1));
infoMachine._xscale = 100 * dScale;
infoMachine._yscale = 100 * dScale;
infoMachine._x = infoMachine.vecInfinite[0] + ((infoMachine.vecPosition[0] - infoMachine.vecInfinite[0]) * dScale);
infoMachine._y = infoMachine.vecInfinite[1] + ((infoMachine.vecPosition[1] - infoMachine.vecInfinite[1]) * dScale);
infoMachine._alpha = 100;
if (infoMachine.vecPosition[2] < 1) {
infoMachine.iProc++;
}
}
if (infoMachine.iProc == 4) {
infoMachine._y = (infoMachine.vecPosition[1] + (Math.random() * 0.5)) - 0.25;
}
}
_root.strDefaultQuality = _quality;
this.iProc = (_root.bOfficial ? 1 : 9);
_parent.infoStatus._visible = _root.strKey.length != 0;
if (!_root.bOfficial) {
_parent._visible = true;
return(undefined);
}
this.iStartTime = getTimer();
this.infoMachine = _parent.infoMachine;
this.infoLogo = _parent.infoLogo;
this.createEmptyMovieClip("infoFlow", 1);
initLogo();
initMachine();
initFlow();
}
onClipEvent (enterFrame) {
if (this.iProc == 0) {
return(undefined);
}
if (this.iProc == 1) {
if ((getTimer() - this.iStartTime) < 1000) {
return(undefined);
}
_parent._visible = true;
this.iProc++;
}
if (this.iProc == 2) {
if ((((getTimer() - this.iStartTime) > 6000) && (infoLogo._alpha > 90)) && (_root.infoMap.iProc == 0)) {
_parent.gotoAndPlay("READY-START");
this.iProc = 3;
}
}
if (this.iProc == 9) {
return(undefined);
}
drawFlow();
moveLogo();
procMachine();
}
onClipEvent (mouseDown) {
if (this.iProc == 9) {
getURL ("http://www.dawgsdk.org/monacircuit/", "_self");
}
}
Symbol 63 MovieClip Frame 2
this.infoLogo.bActive = true;
this.stop();
Symbol 63 MovieClip Frame 3
this.stop();
Symbol 63 MovieClip Frame 4
this.stop();
Symbol 76 Button
on (release) {
clickOK();
}
Symbol 82 MovieClip Frame 1
this.stop();
Symbol 85 Button
on (release) {
clickExit();
}
Symbol 93 Button
on (release) {
clickSteering(4);
}
Symbol 94 Button
on (release) {
clickSteering(3);
}
Symbol 95 Button
on (release) {
clickSteering(2);
}
Symbol 96 Button
on (release) {
clickSteering(1);
}
Symbol 97 Button
on (release) {
clickSteering(0);
}
Symbol 99 Button
on (release) {
clickMode(0);
}
Symbol 100 Button
on (release) {
clickMode(1);
}
Symbol 101 Button
on (release) {
clickMode(2);
}
Instance of Symbol 84 MovieClip "infoArrow" in Symbol 102 MovieClip Frame 1
onClipEvent (load) {
this.iStartTime = getTimer();
}
onClipEvent (enterFrame) {
this._alpha = Math.min(Math.max(0, 50 + (80 * Math.cos(((getTimer() - this.iStartTime) * Math.PI) / 500))), 100);
}
Symbol 115 MovieClip Frame 1
this._visible = false;
this.stop();
Symbol 115 MovieClip Frame 2
this.iStartTime = getTimer();
Symbol 115 MovieClip Frame 3
this._visible = (parseInt((getTimer() - this.iStartTime) / 500) & 1) == 0;
Symbol 115 MovieClip Frame 5
if ((getTimer() - this.iStartTime) > 4000) {
this.gotoAndStop(1);
} else {
this.gotoAndPlay("LOOP");
}
Symbol 115 MovieClip Frame 7
this._visible = true;
this.stop();
Symbol 115 MovieClip Frame 8
this._visible = true;
this.stop();
Symbol 115 MovieClip Frame 9
this._visible = true;
this.stop();
Symbol 125 MovieClip Frame 1
this.stop();
Symbol 143 Button
on (release) {
this.clickRanking();
}
Symbol 145 Button
on (release) {
clickExitResult();
}
Symbol 149 Button
on (release) {
this.sendResults();
}
Symbol 151 Button
on (release) {
this.gotoAndStop("DEFAULT");
}
Instance of Symbol 156 MovieClip in Symbol 157 MovieClip Frame 1
onClipEvent (load) {
function loopWait() {
this._x = (Math.floor(getTimer() / 10) % 200) - 100;
}
loopWait();
}
onClipEvent (enterFrame) {
loopWait();
}
Symbol 160 Button
on (release) {
this.clickExitError();
}
Symbol 162 MovieClip Frame 1
this.stop();
Symbol 162 MovieClip Frame 2
this.stop();
Symbol 162 MovieClip Frame 3
this.stop();
Symbol 162 MovieClip Frame 4
this.stop();
Instance of Symbol 157 MovieClip in Symbol 162 MovieClip Frame 4
onClipEvent (enterFrame) {
_parent.procWait();
}
Symbol 162 MovieClip Frame 5
this.stop();
Symbol 162 MovieClip Frame 6
this.stop();