Frame 1
_global.gameMode = 0;
_global.championshipLevel = 0;
_global.championshipLevelMax = 6;
_global.currentTrackName = "mcTrack_1";
_global.track_collision_on = true;
_global.bonusNames = new Array("nitro", "steer");
_global.bonusTime = new Array(240000, 240);
_global.openSite = function () {
getURL ("http://www.gametop.com/stats/monstertruckracing.html", "_blank");
};
_global.enableSound = function (is_on) {
_global.soundOn = is_on;
trace("_global.soundOn = " + _global.soundOn);
};
_global.playSound = function (sound_mark) {
if (_global.soundOn == false) {
return(undefined);
}
if (!_root.sounds) {
return(undefined);
}
_root.sounds.gotoAndPlay(sound_mark);
};
_global.randRange = function (min, max) {
var _local1 = Math.floor(Math.random() * ((max - min) + 1)) + min;
return(_local1);
};
_global.lineInterpolation = function (ymin, ymax, xmin, xmax, xcur) {
var _local3;
var _local1;
var _local2;
_local1 = (ymax - ymin) / (xmax - xmin);
_local2 = ymin - (_local1 * xmin);
_local3 = (_local1 * xcur) + _local2;
return(_local3);
};
_global.vecLength = function (px, py) {
var _local2 = (px * px) + (py * py);
var _local1 = Math.sqrt(_local2);
return(_local1);
};
_global.vecDotProduct = function (px1, py1, px2, py2) {
var _local1 = (px1 * px2) + (py1 * py2);
return(_local1);
};
_global.vecGetAngle = function (px1, py1, px2, py2) {
px1 = _global.roundTo(px1, 0.0001);
px2 = _global.roundTo(px2, 0.0001);
py1 = _global.roundTo(py1, 0.0001);
py2 = _global.roundTo(py2, 0.0001);
var _local8 = _global.vecLength(px1, py1);
if (_local8 == 0) {
return(0);
}
var _local7 = _global.vecLength(px2, py2);
if (_local7 == 0) {
return(0);
}
px1 = px1 / _local8;
py1 = py1 / _local8;
px2 = px2 / _local7;
py2 = py2 / _local7;
var _local9 = vecDotProduct(px1, py1, px2, py2);
var _local10 = Math.acos(_local9);
var _local2 = (_local10 * 180) / Math.PI;
if (py2 < 0) {
_local2 = -_local2;
}
_local2 = _global.roundTo(_local2, 0.01);
return(_local2);
};
_global.roundTo = function (value, base) {
return(Math.floor((value + (base / 2)) / base) * base);
};
_global.formTimeStr = function (seconds) {
if ((seconds < 0) || (seconds == undefined)) {
return("error!");
}
var _local3 = Math.round(seconds / 1000);
var _local2 = _local3 % 60;
if (_local2 < 10) {
_local2 = "0" + _local2;
}
var _local1 = Math.floor(_local3 / 60);
if (_local1 < 10) {
_local1 = "0" + _local1;
}
var _local5 = ((_local1 + ":") + _local2) + newline;
return(_local5);
};
_global.onNewGame = function () {
_root.mcActionMenu.startWait("select_game");
};
_global.onHelp = function () {
_root.mcActionMenu.startWait("help");
};
_global.onMoreFreeGames = function () {
_global.openSite();
};
_global.onMainMenu_LevelStats = function () {
_root.mcActionMenu.startWait("menu", "root");
};
_global.onMainMenu_Help = function () {
_root.mcActionMenu.startWait("main");
};
_global.onMainMenu_Pause = function () {
_root.mcActionGame.startWait("menu", "root");
};
_global.onMainMenu_SelectGame = function () {
_root.mcActionMenu.startWait("main");
};
_global.onMainMenu_SelectTrack = function () {
_root.mcActionMenu.startWait("select_game");
};
_global.onChampionship = function () {
_global.gameMode = 0;
_global.championshipLevel = 0;
_global.startGame();
};
_global.onSingleRace = function () {
_global.gameMode = 3;
_root.mcActionMenu.startWait("select_track");
};
_global.onTrial = function () {
_global.gameMode = 1;
_root.mcActionMenu.startWait("select_track");
};
_global.onShadowRace = function () {
_global.gameMode = 2;
_root.mcActionMenu.startWait("select_track");
};
_global.onSelectTrack1 = function () {
_global.currentTrackName = "mcTrack_1";
_global.startGame();
};
_global.onSelectTrack2 = function () {
_global.currentTrackName = "mcTrack_2";
_global.startGame();
};
_global.onSelectTrack3 = function () {
_global.currentTrackName = "mcTrack_3";
_global.startGame();
};
_global.onSelectTrack4 = function () {
_global.currentTrackName = "mcTrack_4";
_global.startGame();
};
_global.onSelectTrack5 = function () {
_global.currentTrackName = "mcTrack_5";
_global.startGame();
};
_global.onSelectTrack6 = function () {
_global.currentTrackName = "mcTrack_6";
_global.startGame();
};
_global.startGame = function () {
var _local3 = "ERROR!";
if (_global.gameMode == 1) {
_local3 = "trial";
} else if (_global.gameMode == 2) {
_local3 = "shadow race";
} else if (_global.gameMode == 0) {
_local3 = "championship";
} else if (_global.gameMode == 3) {
_local3 = "single race";
}
trace("");
trace("Starting game...");
trace(((("game mode: " + _global.gameMode) + " [") + _local3) + "];");
if (_global.gameMode == 0) {
trace(("championship level: " + _global.championshipLevel) + ";");
} else {
trace(("track name: " + _global.currentTrackName) + ";");
}
trace("");
_root.mcActionMenu.startWait("game", "root");
};
_global.onOk_LevelStatistic = function () {
if (_global.gameMode == 0) {
if (_global.iStatHeaderFrame == 1) {
_global.championshipLevel++;
}
if (_global.championshipLevel == _global.championshipLevelMax) {
_root.mcActionMenu.startWait("championshipCompleted", "root");
} else {
_root.mcActionMenu.startWait("game", "root");
}
} else {
_root.mcActionMenu.startWait("menu", "root");
}
};
_global.onOk_ChampionshipCompleted = function () {
_root.mcActionMenu.startWait("menu", "root");
};
_global.onPause_Resume = function () {
_root.mcActionGame.gamePause(false);
};
_global.onPause_Restart = function () {
_root.mcActionGame.startWait("gameRestart", "root");
};
_global.friction1 = 0.25;
_global.wheel_omega1 = 6;
_global.max_wheel_ang1 = 30;
_global.acc1 = 0.75;
_global.max_speed1 = 15;
_global.dir_omega1 = 4;
_global.min_speed_for_rotate1 = 3;
_global.speed_for_break_when_rotate1 = 3;
_global.add_friction_min1 = 0.25;
_global.add_friction_max1 = 0.25;
_global.speed_add_friction_min1 = 8;
_global.speed_add_friction_max1 = 15;
_global.min_speed_for_drift1 = 1000;
_global.min_wheel_angle_for_drift1 = 40;
_global.max_wheel_angle_for_drift1 = 40;
_global.drift_coeff_min1 = 0;
_global.drift_coeff_max1 = 0;
_global.collision_speed_lost_coeff1 = 0.5;
_global.block_control_time1 = 12;
_global.arCars = new Array();
var car = null;
car = new Object();
car.drivername = "player";
car.carname = "mcCarRed";
car.is_player = true;
car.friction1 = 0.25;
car.wheel_omega1 = 8;
car.max_wheel_ang1 = 45;
car.acc1 = 0.75;
car.max_speed1 = 25;
car.dir_omega1 = 4;
car.min_speed_for_rotate1 = 4;
car.speed_for_break_when_rotate1 = 15;
car.add_friction_min1 = 0.15;
car.add_friction_max1 = 0.15;
car.speed_add_friction_min1 = 8;
car.speed_add_friction_max1 = 15;
car.min_speed_for_drift1 = 15;
car.min_wheel_angle_for_drift1 = 20;
car.max_wheel_angle_for_drift1 = 40;
car.drift_coeff_min1 = 0.01;
car.drift_coeff_max1 = 0.2;
car.collision_speed_lost_coeff1 = 0.5;
car.block_control_time1 = 12;
_global.arCars.push(car);
car = new Object();
car.drivername = "carShadow";
car.carname = "mcCarShadow";
car.is_player = false;
car.friction1 = 0.25;
car.wheel_omega1 = 6;
car.max_wheel_ang1 = 30;
car.acc1 = 0.75;
car.max_speed1 = 15;
car.dir_omega1 = 4;
car.min_speed_for_rotate1 = 4;
car.speed_for_break_when_rotate1 = 3;
car.add_friction_min1 = 0.25;
car.add_friction_max1 = 0.25;
car.speed_add_friction_min1 = 8;
car.speed_add_friction_max1 = 15;
car.min_speed_for_drift1 = 1000;
car.min_wheel_angle_for_drift1 = 40;
car.max_wheel_angle_for_drift1 = 40;
car.drift_coeff_min1 = 0;
car.drift_coeff_max1 = 0;
car.collision_speed_lost_coeff1 = 0.5;
car.block_control_time1 = 12;
_global.arCars.push(car);
car = new Object();
car.drivername = "comp_1";
car.carname = "mcCarGreen";
car.friction1 = 0.25;
car.wheel_omega1 = 6;
car.max_wheel_ang1 = 30;
car.acc1 = 0.75;
car.max_speed1 = 15;
car.dir_omega1 = 3;
car.min_speed_for_rotate1 = 3;
car.speed_for_break_when_rotate1 = 3;
car.add_friction_min1 = 0.25;
car.add_friction_max1 = 0.25;
car.speed_add_friction_min1 = 8;
car.speed_add_friction_max1 = 15;
car.min_speed_for_drift1 = 1000;
car.min_wheel_angle_for_drift1 = 40;
car.max_wheel_angle_for_drift1 = 40;
car.drift_coeff_min1 = 0;
car.drift_coeff_max1 = 0;
car.collision_speed_lost_coeff1 = 0.5;
car.block_control_time1 = 12;
_global.arCars.push(car);
car = new Object();
car.drivername = "comp_2";
car.carname = "mcCarBlue";
car.friction1 = 0.25;
car.wheel_omega1 = 6;
car.max_wheel_ang1 = 30;
car.acc1 = 0.75;
car.max_speed1 = 15;
car.dir_omega1 = 4;
car.min_speed_for_rotate1 = 3;
car.speed_for_break_when_rotate1 = 3;
car.add_friction_min1 = 0.25;
car.add_friction_max1 = 0.25;
car.speed_add_friction_min1 = 8;
car.speed_add_friction_max1 = 15;
car.min_speed_for_drift1 = 1000;
car.min_wheel_angle_for_drift1 = 40;
car.max_wheel_angle_for_drift1 = 40;
car.drift_coeff_min1 = 0;
car.drift_coeff_max1 = 0;
car.collision_speed_lost_coeff1 = 0.5;
car.block_control_time1 = 12;
_global.arCars.push(car);
car = new Object();
car.drivername = "comp_3";
car.carname = "mcCarYellow";
car.friction1 = 0.25;
car.wheel_omega1 = 6;
car.max_wheel_ang1 = 30;
car.acc1 = 0.75;
car.max_speed1 = 15;
car.dir_omega1 = 4;
car.min_speed_for_rotate1 = 3;
car.speed_for_break_when_rotate1 = 3;
car.add_friction_min1 = 0.25;
car.add_friction_max1 = 0.25;
car.speed_add_friction_min1 = 8;
car.speed_add_friction_max1 = 15;
car.min_speed_for_drift1 = 1000;
car.min_wheel_angle_for_drift1 = 40;
car.max_wheel_angle_for_drift1 = 40;
car.drift_coeff_min1 = 0;
car.drift_coeff_max1 = 0;
car.collision_speed_lost_coeff1 = 0.5;
car.block_control_time1 = 12;
_global.arCars.push(car);
car = new Object();
car.drivername = "comp_4";
car.carname = "mcCarOrange";
car.friction1 = 0.25;
car.wheel_omega1 = 6;
car.max_wheel_ang1 = 30;
car.acc1 = 0.75;
car.max_speed1 = 15;
car.dir_omega1 = 4;
car.min_speed_for_rotate1 = 3;
car.speed_for_break_when_rotate1 = 3;
car.add_friction_min1 = 0.25;
car.add_friction_max1 = 0.25;
car.speed_add_friction_min1 = 8;
car.speed_add_friction_max1 = 15;
car.min_speed_for_drift1 = 1000;
car.min_wheel_angle_for_drift1 = 40;
car.max_wheel_angle_for_drift1 = 40;
car.drift_coeff_min1 = 0;
car.drift_coeff_max1 = 0;
car.collision_speed_lost_coeff1 = 0.5;
car.block_control_time1 = 12;
_global.arCars.push(car);
_global.arLevels = new Array();
var level = null;
level = new Object();
level.trackname = "mcTrack_1";
level.lapnum = 3;
level.cars = "player,comp_1,comp_2,comp_3,comp_4";
level.view_width = 3500;
level.view_height = 3500;
level.node_steps = 20;
_global.arLevels.push(level);
level = new Object();
level.trackname = "mcTrack_2";
level.lapnum = 3;
level.cars = "player,comp_1,comp_2,comp_3,comp_4";
level.view_width = 3400;
level.view_height = 3800;
level.node_steps = 10;
_global.arLevels.push(level);
level = new Object();
level.trackname = "mcTrack_3";
level.lapnum = 3;
level.cars = "player,comp_1,comp_2,comp_3,comp_4";
_global.arLevels.push(level);
level = new Object();
level.trackname = "mcTrack_4";
level.lapnum = 3;
level.cars = "player,comp_1,comp_2,comp_3,comp_4";
_global.arLevels.push(level);
level = new Object();
level.trackname = "mcTrack_5";
level.lapnum = 3;
level.cars = "player,comp_1,comp_2,comp_3,comp_4";
_global.arLevels.push(level);
level = new Object();
level.trackname = "mcTrack_6";
level.lapnum = 3;
level.cars = "player,comp_1,comp_2,comp_3,comp_4";
_global.arLevels.push(level);
fscommand ("showmenu", "false");
_focusrect = false;
_root.loaderAnimDelta = 5;
_root.loaderAnimPause = 2500;
_root.parsingAnimDelta = 10;
_global.soundOn = true;
Instance of Symbol 13 MovieClip in Frame 2
onClipEvent (load) {
_alpha = 0;
}
onClipEvent (enterFrame) {
t = _root.getBytesTotal();
l = _root.getBytesLoaded();
bar._xscale = (100 * l) / t;
p = Math.round((1000 * l) / t) / 10;
if (p == Math.floor(p)) {
p = p + ".0";
}
p = p + "%";
tf.text = p;
if (t > 0) {
if ((l < t) && (_alpha < 100)) {
_alpha = (_alpha + 5);
}
if ((l == t) && (_alpha > 0)) {
_alpha = (_alpha - 5);
}
}
}
Frame 3
stop();
Instance of Symbol 16 MovieClip in Frame 3
onClipEvent (load) {
_alpha = 0;
state = 0;
_root.stop();
}
onClipEvent (enterFrame) {
l = _root.getBytesLoaded();
t = _root.getBytesTotal();
if (state == 0) {
_alpha = (_alpha + _root.loaderAnimDelta);
if (_alpha >= 100) {
_alpha = 100;
state = 1;
startPause = getTimer();
}
} else if ((((state == 1) && (t == l)) && (l > 10)) && ((getTimer() - startPause) > _root.loaderAnimPause)) {
var cur_frame = _root.fade_clip._currentframe;
if (cur_frame == 1) {
_root.fade_clip.gotoAndPlay(2);
}
if (cur_frame == 25) {
_root.gotoAndStop("menu");
}
}
}
Frame 10
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
var pv;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
__com_mochibot__("ed4b897c", this, 10301, true);
stop();
Frame 16
stop();
Frame 22
stop();
Frame 36
stop();
Frame 51
gotoAndStop ("game");
Symbol 6 MovieClip Frame 1
stop();
Instance of Symbol 3 MovieClip in Symbol 6 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 799 MovieClip [__Packages.CActionMenu] Frame 0
class CActionMenu extends MovieClip
{
function CActionMenu () {
super();
}
function startWait(gotoLabel, clipName) {
if (m_waitTime > 0) {
return(undefined);
}
m_gotoLabel = gotoLabel;
if (clipName) {
m_clipName = clipName;
} else {
m_clipName = "mcMainMenu";
}
m_waitTime = 25;
_root.fade_clip.gotoAndPlay(2);
}
function onEnterFrame() {
if (m_waitTime <= 0) {
return(undefined);
}
m_waitTime--;
if (m_waitTime > 0) {
return(undefined);
}
if (m_clipName == "root") {
_root.gotoAndStop(m_gotoLabel);
} else {
_root[m_clipName].gotoAndStop(m_gotoLabel);
}
m_gotoLabel = "";
m_waitTime = 0;
}
var m_waitTime = 0;
var m_gotoLabel = "";
var m_clipName = "";
}
Symbol 800 MovieClip [__Packages.CActionGame] Frame 0
class CActionGame extends MovieClip
{
var m_iNumBotCollisions, m_CCars, m_arSaved, m_fShadowX, m_fShadowY, m_fShadowAngle, m_fShadowDepth, m_arWayPoints, m_arDObj, m_viewWidth, m_viewHeight, m_iNodeSteps, m_iFlashPlayerCar, m_iNumBonuses, m_bIsPaused, attachMovie, getNextHighestDepth;
function CActionGame () {
super();
m_bIsInitOk = true;
gameInit();
}
function gameInit() {
_global.raceTime = 0;
_global.raceTimeLap = 0;
_global.racePlace = 0;
_global.racePlaceMax = 0;
m_iNumBotCollisions = 0;
_global.iStatHeaderFrame = 1;
m_iFramesPassed = 0;
m_iTimeStart = getTimer();
m_CCars = new Array();
m_iPlayerCarIndex = -1;
m_iFocusedCar = 0;
var _local14 = null;
if ((_global.gameMode == 0) || (_global.gameMode == 3)) {
_local14 = null;
if (_global.gameMode == 0) {
if ((_global.championshipLevel == undefined) || (_global.championshipLevel < 0)) {
_global.championshipLevel = 0;
}
_local14 = _global.arLevels[_global.championshipLevel];
} else if (_global.gameMode == 3) {
_local14 = findTrackByName(_global.currentTrackName);
}
if (!_local14) {
trace(("gameInit: can't find championship level with index " + _global.championshipLevel) + "!");
m_bIsInitOk = false;
return(undefined);
}
gameAddTrackClip(_local14.trackname);
var _local16 = _local14.cars.split(",");
var _local10 = null;
var _local4 = 0;
while (m_mcTrack["sp" + _local4] != undefined) {
_local10 = findCarByName(_local16[_local4]);
if (_local10 == null) {
trace(((("Can't find car for start point sp" + _local4) + "! Car name is \"") + _local16[_local4]) + "\".");
} else {
gameAddCar(_local10, m_mcTrack["sp" + _local4]._x, m_mcTrack["sp" + _local4]._y, m_mcTrack["sp" + _local4]._rotation, m_mcTrack["sp" + _local4].getDepth(), "sp" + _local4);
}
_local4++;
}
m_iMaxNumLap = _local14.lapnum;
} else if ((_global.gameMode == 1) || (_global.gameMode == 2)) {
_local14 = findTrackByName(_global.currentTrackName);
gameAddTrackClip(_global.currentTrackName);
if (m_mcTrack.sp6) {
gameAddCar(findCarByName("player"), m_mcTrack.sp6._x, m_mcTrack.sp6._y, m_mcTrack.sp6._rotation, m_mcTrack.sp6.getDepth(), "sp6");
} else {
trace("Need sp6 position!");
}
if (_global.gameMode == 2) {
m_iMaxNumLap = 1;
m_iShadowRacePart = 0;
m_arSaved = new Array();
if (m_mcTrack.sp7 == undefined) {
trace("Can't find shadow car position");
} else {
m_fShadowX = m_mcTrack.sp6._x;
m_fShadowY = m_mcTrack.sp6._y;
m_fShadowAngle = m_mcTrack.sp6._rotation;
m_fShadowDepth = m_mcTrack.sp7.getDepth();
}
} else {
m_iMaxNumLap = 3;
}
} else {
trace("ERROR: unknow game mode!!!");
m_bIsInitOk = false;
}
if (!m_bIsInitOk) {
return(undefined);
}
if (m_iPlayerCarIndex == -1) {
trace("No player car was founded!");
} else {
m_CCars[m_iPlayerCarIndex].carSetAIType(1);
m_iFocusedCar = m_iPlayerCarIndex;
}
m_arWayPoints = new Array();
if (m_mcTrack.wayClip) {
var _local4 = 1;
while (_local4 <= m_mcTrack.wayClip._totalframes) {
m_mcTrack.wayClip.gotoAndStop(_local4);
var _local5 = {x:m_mcTrack.wayClip.clop._x + m_mcTrack.wayClip._x, y:m_mcTrack.wayClip.clop._y + m_mcTrack.wayClip._y};
_local5.x = Math.floor(_local5.x);
_local5.y = Math.floor(_local5.y);
m_arWayPoints.push(_local5);
_local4++;
}
m_mcTrack.wayClip.gotoAndStop(1);
m_mcTrack.wayClip._visible = true;
}
m_arDObj = new Array();
var _local9 = m_mcTrack.damageClip;
for (var _local19 in _local9) {
if (typeof(_local9[_local19]) != "movieclip") {
continue;
}
m_arDObj.push(_local9[_local19]);
}
var _local4 = 0;
while (m_mcTrack["sp" + _local4] != undefined) {
m_mcTrack["sp" + _local4]._visible = false;
_local4++;
}
m_mcTrack.sp6._visible = false;
m_mcTrack.sp7._visible = false;
_root.mcGUI.mcStartCounter._visible = true;
_root.mcGUI.mcLastLap._visible = false;
cameraMoveTo(275 - m_CCars[m_iFocusedCar].m_fX, 200 - m_CCars[m_iFocusedCar].m_fY);
m_CCars[m_iFocusedCar].m_mcObj.focus_frame._visible = true;
m_tfDebug = "";
printDebug();
m_viewWidth = m_mcTrack._width - 550;
m_viewHeight = m_mcTrack._height - 400;
if (_local14.view_width != undefined) {
m_viewWidth = _local14.view_width - 550;
}
if (_local14.view_height != undefined) {
m_viewHeight = _local14.view_height - 400;
}
trace("view_width: " + m_viewWidth);
trace("view_height: " + m_viewHeight);
m_iNodeSteps = 10;
if (_local14.node_steps > 0) {
m_iNodeSteps = _local14.node_steps;
}
trace("node steps: " + m_iNodeSteps);
_local4 = 0;
while (_local4 < m_CCars.length) {
if (m_CCars[_local4].carGetAIType() != 0) {
} else {
var _local11 = m_CCars[m_iPlayerCarIndex].m_max_speed1;
var _local12 = m_CCars[m_iPlayerCarIndex].m_acc1;
var _local8 = _local11 - 7;
_local8 = _local8 + _global.randRange(-3, 2);
m_CCars[_local4].m_max_speed1 = _local8;
var _local6 = _local12 - 0.15;
_local6 = _local6 + (_global.randRange(0, 15) / 100);
m_CCars[_local4].m_acc1 = _local6;
trace((_local8 + ",") + _local6);
}
_local4++;
}
if (_global.gameMode == 2) {
gameHideAllBonuses();
} else {
gameResetAllBonuses();
}
gameToggleDebugInfo();
m_iFlashPlayerCar = 0;
_root.mcGUI.bonus_slot1._visible = false;
_root.mcGUI.bonus_slot1.flash_time = 0;
_root.mcGUI.bonus_slot2._visible = false;
_root.mcGUI.bonus_slot2.flash_time = 0;
_root.mcGUI.bonus_slot3._visible = false;
_root.mcGUI.bonus_slot3.flash_time = 0;
_root.mcGUI.bonus_slot4._visible = false;
_root.mcGUI.bonus_slot4.flash_time = 0;
var _local15 = _root.mcGUI.miniMap.track;
_root.mcGUI.miniMap.gotoAndStop(_local14.trackname + "_Mini");
trace("miniMap = " + _local15);
_local4 = m_CCars.length - 1;
while (_local4 >= 0) {
var _local13 = m_CCars[_local4];
var _local7 = _local15.attachMovie(_local13.getCarClipName() + "_Mini", "MiniCar" + _local4, _local15.getNextHighestDepth());
_local7._x = m_CCars[_local4].m_fX;
_local7._y = m_CCars[_local4].m_fY;
_local7._rotation = m_CCars[_local4].m_fAngle;
_local4--;
}
gamePause(false);
}
function gameResetAllBonuses() {
gameResetAllBonuses2();
return(undefined);
while (_local6 < m_iNumBonuses) {
var _local8 = _global.randRange(200, 900);
var _local10 = _local8 + m_iNodeSteps;
var _local5 = m_arWayPoints[_local8];
var _local9 = m_arWayPoints[_local10];
var _local4 = new CVector2D();
_local4.setVector(_local9.x - _local5.x, _local9.y - _local5.y);
_local4.Normalize();
_local4.Rotate(90);
var _local3 = m_mcTrack["bonus" + _local6];
if (!_local3) {
_local3 = m_mcTrack.attachMovie("mcBonus", "bonus" + _local6, m_mcTrack.getNextHighestDepth());
}
var _local7 = _global.randRange(10, 50);
_local3._x = _local5.x + (_local4.getX() * _local7);
_local3._y = _local5.y + (_local4.getY() * _local7);
_local3.bonus_type = 0;
_local3.dead = false;
_local3.gotoAndStop(1);
_local6++;
}
trace("reset bonuses...");
}
function gameResetAllBonuses2() {
if (_global.gameMode == 2) {
return(undefined);
}
var _local4 = 0;
while (m_mcTrack["b" + _local4] != undefined) {
var _local3 = m_mcTrack["b" + _local4];
_local3.dead = false;
_local3._visible = true;
_local3.gotoAndStop(1);
_local3.bonus_type = 0;
_local4++;
}
}
function gameHideAllBonuses() {
var _local2 = 0;
while (m_mcTrack["b" + _local2] != undefined) {
var _local3 = m_mcTrack["b" + _local2];
_local3.dead = true;
_local3._visible = false;
_local2++;
}
}
function gameFrame() {
if (m_gotoWaitTime > 0) {
m_gotoWaitTime--;
if (m_gotoWaitTime <= 0) {
if (m_gotoClipName == "root") {
_root.gotoAndStop(m_gotoLabel);
} else {
_root[m_gotoClipName].gotoAndStop(m_gotoLabel);
}
m_gotoLabel = "";
m_gotoWaitTime = 0;
}
return(undefined);
}
if (m_bIsRaceEnd) {
m_iWaitAfterRace--;
if (m_iWaitAfterRace == 0) {
_root.gotoAndStop("levelStatistic");
_root.stat_header.gotoAndStop(_global.iStatHeaderFrame);
_root.stat_time.text = _global.formTimeStr(_global.raceTime);
_root.stat_timelap.text = _global.formTimeStr(_global.raceTimeLap);
_root.stat_place.text = (_global.racePlace + "/") + _global.racePlaceMax;
}
}
if (!m_bIsInitOk) {
return(undefined);
}
if (m_bIsPaused) {
return(undefined);
}
if (((_global.gameMode == 2) && (m_iShadowRacePart == 1)) && (m_iWaitAfterRace > 0)) {
m_iWaitAfterRace--;
if (m_iWaitAfterRace == 0) {
m_iShadowRacePart = 2;
gameAddShadowCar();
m_CCars[0].carReset();
_root.mcGUI.mcStartCounter._visible = true;
_root.mcGUI.mcStartCounter.gotoAndPlay(1);
cameraMoveTo(275 - m_CCars[0].m_fX, 200 - m_CCars[0].m_fY);
trace("Shadow race: first part ended. Add shadow and restart race.");
}
}
if (_root.mcGUI.mcStartCounter._visible) {
m_iFlashPlayerCar--;
if (m_iFlashPlayerCar <= 0) {
m_CCars[m_iPlayerCarIndex].m_mcObj._visible = !m_CCars[m_iPlayerCarIndex].m_mcObj._visible;
m_iFlashPlayerCar = 6;
}
if (_root.mcGUI.mcStartCounter._currentframe == _root.mcGUI.mcStartCounter._totalframes) {
_root.mcGUI.mcStartCounter._visible = false;
m_CCars[m_iPlayerCarIndex].m_mcObj._visible = true;
}
return(undefined);
}
if (_root.mcGUI.mcLastLap._visible) {
if (_root.mcGUI.mcLastLap._currentframe == _root.mcGUI.mcLastLap._totalframes) {
_root.mcGUI.mcLastLap._visible = false;
}
}
m_tfDebug = "";
m_iFramesPassed++;
m_iTimePassed = getTimer() - m_iTimeStart;
var _local40 = Math.round(m_iTimePassed / 1000);
var _local39 = _local40 % 60;
if (_local39 < 10) {
_local39 = "0" + _local39;
}
var _local43 = Math.floor(_local40 / 60);
var _local42 = ((_local43 + ":") + _local39) + newline;
m_tfDebug = m_tfDebug + _local42;
var _local7 = new Array();
var _local5 = new Array();
var _local36 = _root.mcGUI.miniMap.track;
var _local12 = 0;
while (_local12 < m_CCars.length) {
m_CCars[_local12].carThink();
var _local13 = _local36["MiniCar" + _local12];
if (_local13) {
_local13._x = m_CCars[_local12].m_fX;
_local13._y = m_CCars[_local12].m_fY;
_local13._rotation = m_CCars[_local12].m_fAngle;
}
var _local8 = new Object();
_local8.indx = _local12;
_local8.par = (m_CCars[_local12].m_iCurLap * 1000) + m_CCars[_local12].m_iLastNode;
_local7.push(_local8);
if (m_CCars[_local12].carGetAIType() == 2) {
} else if (m_CCars[_local12].m_immuneToCollision > 0) {
} else {
var _local4 = 0;
while (_local4 < m_CCars.length) {
if (_local12 == _local4) {
} else if (m_CCars[_local4].carGetAIType() == 2) {
} else if (m_CCars[_local4].m_immuneToCollision > 0) {
} else {
var _local10 = false;
var _local18 = _global.vecLength(m_CCars[_local4].m_fX - m_CCars[_local12].m_fX, m_CCars[_local4].m_fY - m_CCars[_local12].m_fY);
if (_local18 <= 60) {
_local10 = true;
}
if (!_local10) {
} else {
var _local9 = false;
var _local6 = 0;
while (_local6 < _local5.length) {
if (((_local5[_local6].c1 == _local12) && (_local5[_local6].c2 == _local4)) || ((_local5[_local6].c1 == _local4) && (_local5[_local6].c2 == _local12))) {
_local9 = true;
break;
}
_local6++;
}
if (_local9) {
} else {
_local8 = new Object();
_local8.c1 = _local12;
_local8.c2 = _local4;
_local5.push(_local8);
}
}
}
_local4++;
}
}
_local12++;
}
_local12 = 0;
while (_local12 < _local5.length) {
var _local20 = _local5[_local12].c1;
var _local19 = _local5[_local12].c2;
var _local11 = m_CCars[_local20];
var _local17 = m_CCars[_local19];
if (m_CCars[_local19].m_iLastNode < m_CCars[_local20].m_iLastNode) {
_local11 = m_CCars[_local19];
_local17 = m_CCars[_local20];
}
_local11.m_mcObj.stop_sign._rotation = 0;
var _local16 = _local11.m_fX - _local17.m_fX;
var _local14 = _local11.m_fY - _local17.m_fY;
var _local22 = _global.vecLength(_local16, _local14) * 10;
_local16 = _local16 / _local22;
_local14 = _local14 / _local22;
var _local24 = (_local11.m_fAngle / 180) * Math.PI;
var _local32 = Math.cos(_local24);
var _local30 = Math.sin(_local24);
var _local23 = (_local17.m_fAngle / 180) * Math.PI;
var _local26 = Math.cos(_local23);
var _local25 = Math.sin(_local23);
var _local31 = _local32 + _local16;
var _local28 = _local30 + _local14;
var _local34 = _global.vecGetAngle(1, 0, _local31, _local28);
var _local29 = _local26 - _local16;
var _local27 = _local25 - _local14;
var _local35 = _global.vecGetAngle(1, 0, _local29, _local27);
_local12++;
}
var _local21 = true;
while (_local21) {
_local21 = false;
var _local6 = 0;
while (_local6 < _local7.length) {
if (_local7[_local6].par < _local7[_local6 + 1].par) {
_local21 = true;
var _local15 = _local7[_local6 + 1];
_local7[_local6 + 1] = _local7[_local6];
_local7[_local6] = _local15;
}
_local6++;
}
}
var _local33 = "";
_local12 = 0;
while (_local12 < _local7.length) {
m_CCars[_local7[_local12].indx].m_iCurPlace = _local12 + 1;
_local33 = _local33 + _local7[_local12].par;
_local33 = _local33 + ",";
_local12++;
}
cameraMoveTo(275 - m_CCars[m_iFocusedCar].m_fX, 200 - m_CCars[m_iFocusedCar].m_fY);
gameProcessInput();
var _local41 = m_CCars[m_iFocusedCar].m_iCurPlace;
var _local45 = m_CCars.length;
var _local37 = m_CCars[m_iFocusedCar].m_iCurLap;
var _local44 = m_iMaxNumLap;
if (_local37 < 1) {
_local37 = 1;
} else if (_local37 > m_iMaxNumLap) {
_local37 = m_iMaxNumLap;
}
_root.mcGUI.tf_place.text = (_local41 + "/") + _local45;
_root.mcGUI.tf_lap.text = (_local37 + "/") + _local44;
var _local38 = m_CCars[m_iFocusedCar].m_iLastNode + m_iNodeSteps;
if (_local38 < 0) {
_local38 = _local38 + m_arWayPoints.length;
}
if (_local38 >= m_arWayPoints.length) {
_local38 = _local38 - m_arWayPoints.length;
}
m_mcTrack.wayClip.gotoAndStop(_local38);
m_tfDebug = m_tfDebug + ("Num Bot Collisions: " + m_iNumBotCollisions);
printDebug();
}
function gameProcessInput() {
if (m_iButtonPressedTime > 0) {
m_iButtonPressedTime--;
return(undefined);
}
var _local2 = 12;
var _local3 = -1;
if (Key.isDown(27) || (Key.isDown(80))) {
gamePause(true);
} else if (Key.isDown(49)) {
m_iButtonPressedTime = _local2;
} else if (Key.isDown(50)) {
m_iButtonPressedTime = _local2;
_local3 = 1;
} else if (Key.isDown(51)) {
m_iButtonPressedTime = _local2;
} else if (Key.isDown(52)) {
m_iButtonPressedTime = _local2;
} else if (Key.isDown(53)) {
m_iButtonPressedTime = _local2;
} else if (Key.isDown(54)) {
m_iButtonPressedTime = _local2;
} else if (Key.isDown(48)) {
m_iButtonPressedTime = _local2;
} else if (Key.isDown(56)) {
m_iButtonPressedTime = _local2;
}
if ((_local3 >= 0) && (_local3 <= (m_CCars.length - 1))) {
if (m_CCars[m_iFocusedCar].carGetAIType() == 1) {
m_CCars[m_iFocusedCar].carSetAIType(0);
}
m_iFocusedCar = _local3;
}
}
function gameToggleDebugInfo() {
var _local3 = 0;
while (_local3 < m_CCars.length) {
m_CCars[_local3].carShowHideCollisionPoints();
m_CCars[_local3].m_mcObj.center._visible = !m_CCars[_local3].m_mcObj.center._visible;
_local3++;
}
m_CCars[m_iFocusedCar].m_mcObj.focus_frame._visible = !m_CCars[m_iFocusedCar].m_mcObj.focus_frame._visible;
m_mcTrack.wayClip._visible = !m_mcTrack.wayClip._visible;
m_mcTrack.hitClip._visible = !m_mcTrack.hitClip._visible;
_local3 = 0;
while (m_mcTrack["f" + _local3] != undefined) {
m_mcTrack["f" + _local3]._visible = !m_mcTrack["f" + _local3]._visible;
_local3++;
}
_root.mcGUI.mcDebug._visible = !_root.mcGUI.mcDebug._visible;
}
function gameAddTrackClip(track_name) {
m_mcTrack = attachMovie(track_name, "mcTrackClip", getNextHighestDepth(), {_x:0, _y:0});
if (!m_mcTrack) {
trace("gameAddTrackClip: can't find clip with linkage " + track_name);
m_bIsInitOk = false;
}
}
function gameAddCar(car_set_obj, px, py, ang, depth, sp_name) {
var _local3 = m_CCars.length;
var _local5 = m_mcTrack.attachMovie(car_set_obj.carname, "Car" + _local3, depth);
var _local2 = new CCar(_local5, px, py, ang);
_local2.carSetPhysicSettings(car_set_obj);
_local2.m_iCurPlace = _local3 + 1;
if (car_set_obj.is_player) {
m_iPlayerCarIndex = _local3;
}
_local2.m_mcObj.focus_frame._visible = false;
_local2.carStopWheel();
_local2.setStartPointName(sp_name);
_local2.setCarClipName(car_set_obj.carname);
m_CCars.push(_local2);
}
function cameraMoveTo(need_x, need_y) {
var _local3 = m_mcTrack._x;
var _local2 = m_mcTrack._y;
m_mcTrack._x = m_mcTrack._x + (need_x - _local3);
m_mcTrack._y = m_mcTrack._y + (need_y - _local2);
if (m_mcTrack._x > 0) {
m_mcTrack._x = 0;
} else if (m_mcTrack._x < (-m_viewWidth)) {
m_mcTrack._x = -m_viewWidth;
}
if (m_mcTrack._y > 0) {
m_mcTrack._y = 0;
} else if (m_mcTrack._y < (-m_viewHeight)) {
m_mcTrack._y = -m_viewHeight;
}
}
function findCarByName(drivername) {
if (drivername == undefined) {
return(null);
}
var _local3 = null;
var _local2 = 0;
while (_local2 < _global.arCars.length) {
if (_global.arCars[_local2].drivername != drivername) {
} else {
_local3 = _global.arCars[_local2];
break;
}
_local2++;
}
return(_local3);
}
function printDebug() {
_root.mcGUI.mcDebug.tf.text = m_tfDebug;
}
function onEnterFrame() {
gameFrame();
}
function getHitClip() {
return(m_mcTrack.hitClip);
}
function getTrackClip() {
return(m_mcTrack);
}
function getNearestNodeIndex(pos_x, pos_y, hint) {
var _local9 = 0;
var _local6 = 1000000 /* 0x0F4240 */;
var _local7 = 0;
var _local8 = m_arWayPoints.length;
if (hint >= 0) {
_local7 = hint - Math.floor(m_iNodeSteps / 2);
_local8 = hint + Math.floor(m_iNodeSteps / 2);
}
var _local5 = _local7;
while (_local5 < _local8) {
var _local3 = _local5;
if (_local3 < 0) {
_local3 = _local3 + m_arWayPoints.length;
}
if (_local3 >= m_arWayPoints.length) {
_local3 = _local3 - m_arWayPoints.length;
}
var _local4 = _global.vecLength(pos_x - m_arWayPoints[_local3].x, pos_y - m_arWayPoints[_local3].y);
if (_local4 == 0) {
_local4 = 1000000000 /* 0x3B9ACA00 */;
}
if (_local4 < _local6) {
_local6 = _local4;
_local9 = _local3;
}
_local5++;
}
return(_local9);
}
function getTrackNode(n) {
if (n < 0) {
n = n + m_arWayPoints.length;
}
if (n >= m_arWayPoints.length) {
n = n - m_arWayPoints.length;
}
var _local3 = {x:m_arWayPoints[n].x, y:m_arWayPoints[n].y};
return(_local3);
}
function gameEndRace() {
if ((_global.gameMode == 2) && (m_iShadowRacePart == 0)) {
_root.fade_clip.gotoAndPlay(2);
m_iWaitAfterRace = 25;
m_iShadowRacePart = 1;
return(undefined);
}
if ((_global.gameMode == 2) && (m_iShadowRacePart == 1)) {
return(undefined);
}
var _local5 = 100;
var _local6 = 0;
var _local4 = 0;
while (_local4 < m_CCars.length) {
if (m_CCars[_local4].carGetAIType() != 1) {
} else {
_local5 = m_CCars[_local4].m_iCurPlace;
_local6 = m_CCars[_local4].m_iBestLap;
break;
}
_local4++;
}
_global.raceTime = m_iTimePassed;
_global.raceTimeLap = _local6;
_global.racePlace = _local5;
_global.racePlaceMax = m_CCars.length;
var _local7 = "ERROR!";
if (_global.gameMode == 1) {
_local7 = "trial";
} else if (_global.gameMode == 2) {
_local7 = "shadow race";
} else if (_global.gameMode == 0) {
_local7 = "championship";
} else if (_global.gameMode == 3) {
_local7 = "single race";
}
trace("");
trace("End game...");
trace(((("game mode: " + _global.gameMode) + " [") + _local7) + "];");
if (_global.gameMode == 0) {
trace(("championship level: " + _global.championshipLevel) + ";");
} else {
trace(("track name: " + _global.currentTrackName) + ";");
}
trace((("player place: " + _local5) + "/") + m_CCars.length);
trace("");
m_bIsRaceEnd = true;
m_iWaitAfterRace = 25;
_root.fade_clip.gotoAndPlay(2);
if (_global.gameMode == 1) {
_global.iStatHeaderFrame = 4;
_global.playSound("sndWin");
} else if (((_global.gameMode == 2) || (_global.gameMode == 0)) || (_global.gameMode == 3)) {
_global.iStatHeaderFrame = 1;
if (_local5 > 1) {
_global.iStatHeaderFrame = 2;
_global.playSound("sndLose");
} else {
_global.playSound("sndWin");
}
}
}
function gameSavePositionForShadowCar(cx, cy, angle, wangle, node) {
if (_global.gameMode != 2) {
return(undefined);
}
if (m_iShadowRacePart != 0) {
return(undefined);
}
var _local3 = new Object();
_local3.x = cx;
_local3.y = cy;
_local3.angle = angle;
_local3.wangle = wangle;
_local3.node = node;
m_arSaved.push(_local3);
}
function gameGetNextSavedPosition() {
var _local2 = null;
if (m_arSaved[0] != undefined) {
_local2 = m_arSaved[0];
m_arSaved.shift();
}
return(_local2);
}
function gameAddShadowCar() {
var _local4 = "carShadow";
var _local6 = findCarByName(_local4);
if (_local6 == null) {
trace(("Can't find shadow car! Car name is \"" + _local4) + "\".");
return(undefined);
}
gameAddCar(_local6, m_fShadowX, m_fShadowY, m_fShadowAngle, m_fShadowDepth, "sp7");
m_CCars[1].carSetAIType(2);
var _local5 = _root.mcGUI.miniMap.track.track;
var _local7 = m_CCars[1];
var _local3 = _local5.attachMovie(_local7.getCarClipName() + "_Mini", "MiniCar1", _local5.getNextHighestDepth());
_local3._x = m_CCars[1].m_fX;
_local3._y = m_CCars[1].m_fY;
_local3._rotation = m_CCars[1].m_fAngle;
m_iButtonPressedTime = 0;
}
function findTrackByName(trname) {
var _local3 = null;
var _local2 = 0;
while (_local2 < _global.arLevels.length) {
if (_global.arLevels[_local2].trackname != trname) {
} else {
_local3 = _global.arLevels[_local2];
break;
}
_local2++;
}
return(_local3);
}
function startWait(gotoLabel, clipName) {
if (m_gotoWaitTime > 0) {
return(undefined);
}
m_gotoLabel = gotoLabel;
if (clipName) {
m_gotoClipName = clipName;
} else {
m_gotoClipName = "mcMainMenu";
}
m_gotoWaitTime = 25;
_root.fade_clip.gotoAndPlay(2);
}
function gamePause(bIs) {
m_bIsPaused = bIs;
_root.mcGUI.pause_win._visible = bIs;
}
function gameIsOnScreen(px, py) {
var _local3 = m_CCars[m_iFocusedCar].m_fX;
var _local2 = m_CCars[m_iFocusedCar].m_fY;
var _local6 = _local3 - 275;
var _local4 = _local3 + 275;
var _local5 = _local2 - 200;
var _local7 = _local2 + 200;
if ((((px >= _local6) && (px <= _local4)) && (py >= _local5)) && (py <= _local7)) {
return(true);
}
return(false);
}
var m_iFramesPassed = 0;
var m_iTimePassed = 0;
var m_iTimeStart = 0;
var m_mcTrack = null;
var m_iPlayerCarIndex = -1;
var m_iFocusedCar = 0;
var m_tfDebug = "";
var m_iButtonPressedTime = 0;
var m_bIsInitOk = false;
var m_iMaxNumLap = 3;
var m_iShadowRacePart = 0;
var m_bIsRaceEnd = false;
var m_iWaitAfterRace = 25;
var m_gotoWaitTime = 0;
var m_gotoLabel = "";
var m_gotoClipName = "";
}
Symbol 801 MovieClip [__Packages.CVector2D] Frame 0
class CVector2D
{
var m_fX, m_fY;
function CVector2D () {
m_fX = 0;
m_fY = 0;
}
function setVector(x, y) {
m_fX = x;
m_fY = y;
}
function setX(x) {
m_fX = x;
}
function getX() {
return(m_fX);
}
function setY(y) {
m_fY = y;
}
function getY() {
return(m_fY);
}
function getLengthPow2() {
var _local2 = (m_fX * m_fX) + (m_fY * m_fY);
return(_local2);
}
function getLength() {
var _local3 = getLengthPow2();
var _local2 = Math.sqrt(_local3);
return(_local2);
}
function calcLength(px, py) {
var _local2 = (px * px) + (py * py);
var _local1 = Math.sqrt(_local2);
return(_local1);
}
function Normalize() {
var _local2 = getLength();
if (_local2 == 0) {
return(undefined);
}
m_fX = m_fX / _local2;
m_fY = m_fY / _local2;
}
function Add(add_x, add_y) {
m_fX = m_fX + add_x;
m_fY = m_fY + add_y;
}
function AddX(add_x) {
m_fX = m_fX + add_x;
}
function AddY(add_y) {
m_fY = m_fY + add_y;
}
function Scale(scale_x, scale_y) {
m_fX = m_fX * scale_x;
m_fY = m_fY * scale_y;
}
function ScaleX(scale_x) {
m_fX = m_fX * scale_x;
}
function ScaleY(scale_y) {
m_fY = m_fY * scale_y;
}
function DotProduct(vec2_x, vec2_y) {
var _local2 = (m_fX * vec2_x) + (m_fY * vec2_y);
return(_local2);
}
function getAngle(dir_x, dir_y) {
var _local4 = getLength();
if (_local4 == 0) {
return(0);
}
var _local5 = calcLength(dir_x, dir_y);
if (_local5 == 0) {
return(0);
}
var _local2 = DotProduct(dir_x, dir_y);
var _local6 = Math.acos(_local2);
var _local3 = (_local6 * 180) / Math.PI;
return(_local3);
}
function Rotate(ang) {
var _local5 = (ang * Math.PI) / 180;
var _local4 = Math.sin(_local5);
var _local3 = Math.cos(_local5);
_local3 = _global.roundTo(_local3, 0.0001);
_local4 = _global.roundTo(_local4, 0.0001);
m_fX = _global.roundTo(m_fX, 0.0001);
m_fY = _global.roundTo(m_fY, 0.0001);
var _local7 = m_fX;
var _local6 = m_fY;
m_fX = (_local7 * _local3) - (_local6 * _local4);
m_fY = (_local6 * _local3) + (_local7 * _local4);
}
}
Symbol 802 MovieClip [__Packages.CCar] Frame 0
class CCar
{
var m_arLastCollision, m_immuneToCollision, m_iActiveBonusType, m_iActiveBonusTime, m_bIsNitroEffect, m_bIsNitroIncSpeed, m_fLastSledX, m_fLastSledY, m_iTimeFromLastCollision, m_iNitroMaxSpeed, m_spName, m_mcCarName;
function CCar (clip, pos_x, pos_y, angle) {
m_mcObj = clip;
m_fStartX = pos_x;
m_fStartY = pos_y;
m_fStartAngle = angle;
m_mcObj.stop_sign._visible = false;
m_fX = pos_x;
m_fY = pos_y;
m_fAngle = angle;
m_fStartX = m_fX;
m_fStartY = m_fY;
m_fStartAngle = m_fAngle;
m_fWheelAngle = 0;
m_iAIType = 0;
carSetSpeed(0);
m_arLastCollision = new Array();
m_friction1 = _global.friction1;
m_wheel_omega1 = _global.wheel_omega1;
m_max_wheel_ang1 = _global.max_wheel_ang1;
m_acc1 = _global.acc1;
m_max_speed1 = _global.max_speed1;
m_dir_omega1 = _global.dir_omega1;
m_min_speed_for_rotate1 = _global.min_speed_for_rotate1;
m_speed_for_break_when_rotate1 = _global.speed_for_break_when_rotate1;
m_add_friction_min1 = _global.add_friction_min1;
m_add_friction_max1 = _global.add_friction_max1;
m_speed_add_friction_min1 = _global.speed_add_friction_min1;
m_speed_add_friction_max1 = _global.speed_add_friction_max1;
m_collision_speed_lost_coeff1 = _global.collision_speed_lost_coeff1;
m_block_control_time1 = _global.block_control_time1;
m_min_speed_for_drift1 = _global.min_speed_for_drift1;
m_min_wheel_angle_for_drift1 = _global.min_wheel_angle_for_drift1;
m_max_wheel_angle_for_drift1 = _global.max_wheel_angle_for_drift1;
m_drift_coeff_min1 = _global.drift_coeff_min1;
m_drift_coeff_max1 = _global.drift_coeff_max1;
m_iTimeStart = getTimer();
m_iLastNode = _root.mcActionGame.getNearestNodeIndex(m_fX, m_fY, -1);
m_immuneToCollision = 0;
m_iActiveBonusType = new Array(-1, -1, -1, -1);
m_iActiveBonusTime = new Array(0, 0, 0, 0);
m_bIsNitroEffect = false;
m_bIsNitroIncSpeed = false;
m_mcObj.turbo._visible = false;
carSetMovieClip();
m_fLastSledX = new Array();
m_fLastSledY = new Array();
var _local4 = carGetWheelGlobalPos("bWheel1");
m_fLastSledX[0] = _local4.x;
m_fLastSledY[0] = _local4.y;
_local4 = carGetWheelGlobalPos("bWheel2");
m_fLastSledX[1] = _local4.x;
m_fLastSledY[1] = _local4.y;
_local4 = carGetWheelGlobalPos("fWheel1");
m_fLastSledX[2] = _local4.x;
m_fLastSledY[2] = _local4.y;
_local4 = carGetWheelGlobalPos("fWheel2");
m_fLastSledX[3] = _local4.x;
m_fLastSledY[3] = _local4.y;
m_iTimeFromLastCollision = 0;
}
function carReset() {
m_fX = m_fStartX;
m_fY = m_fStartY;
m_fAngle = m_fStartAngle;
m_fPreX = m_fX;
m_fPreY = m_fY;
m_fPreAngle = m_fAngle;
m_fWheelAngle = 0;
carSetSpeed(0);
m_iLastNode = _root.mcActionGame.getNearestNodeIndex(m_fX, m_fY, -1);
delete m_arLastCollision;
m_arLastCollision = new Array();
m_iCurLap = (m_iRowLap = 0);
m_iBlockControlTime = 0;
m_fFakeWheelAngle = 0;
m_iBestLap = 100000 /* 0x0186A0 */;
m_iLapTime = 0;
m_iTimeStart = getTimer();
m_mcObj.stop_sign._visible = false;
m_immuneToCollision = 0;
var _local3 = carGetWheelGlobalPos("bWheel1");
m_fLastSledX[0] = _local3.x;
m_fLastSledY[0] = _local3.y;
_local3 = carGetWheelGlobalPos("bWheel2");
m_fLastSledX[1] = _local3.x;
m_fLastSledY[1] = _local3.y;
_local3 = carGetWheelGlobalPos("fWheel1");
m_fLastSledX[2] = _local3.x;
m_fLastSledY[2] = _local3.y;
_local3 = carGetWheelGlobalPos("fWheel2");
m_fLastSledX[3] = _local3.x;
m_fLastSledY[3] = _local3.y;
m_iTimeFromLastCollision = 0;
carBonusDropAll();
carSetMovieClip();
}
function carThink() {
m_iLiveFrames++;
m_iLapTime = getTimer() - m_iTimeStart;
m_fPreX = m_fX;
m_fPreY = m_fY;
m_fPreAngle = m_fAngle;
if (m_immuneToCollision > 0) {
m_immuneToCollision--;
}
var _local6 = 0;
while (_local6 < m_iActiveBonusType.length) {
if (m_iActiveBonusType[_local6] >= 0) {
m_iActiveBonusTime[_local6]--;
var _local5 = Math.floor(m_iActiveBonusTime[_local6] / 24) + 1;
if (_local5 < 1000) {
_root.mcGUI["bonus_slot" + (_local6 + 1)].tf.text = _local5;
if (_local5 < 10) {
_root.mcGUI["bonus_slot" + (_local6 + 1)].tf.text = "0" + _local5;
}
} else {
_root.mcGUI["bonus_slot" + (_local6 + 1)].tf.text = "";
}
var _local7 = _global.bonusTime[m_iActiveBonusType[_local6]];
if (m_iActiveBonusTime[_local6] < (_local7 * 0.2)) {
_root.mcGUI["bonus_slot" + (_local6 + 1)].flash_time--;
if (_root.mcGUI["bonus_slot" + (_local6 + 1)].flash_time <= 0) {
_root.mcGUI["bonus_slot" + (_local6 + 1)].flash_time = 6;
_root.mcGUI["bonus_slot" + (_local6 + 1)]._visible = !_root.mcGUI["bonus_slot" + (_local6 + 1)]._visible;
}
}
if (m_iActiveBonusTime[_local6] <= 0) {
carBonusDrop(_local6);
}
}
_local6++;
}
var _local12 = _root.mcActionGame.getNearestNodeIndex(m_fX, m_fY, m_iLastNode);
var _local11 = _root.mcActionGame.getTrackNode(_local12 + _root.mcActionGame.m_iNodeSteps);
m_fNodeX = _local11.x;
m_fNodeY = _local11.y;
m_iLastNode = _local12;
var _local10 = _root.mcActionGame.getTrackNode(m_iLastNode);
var _local13 = _root.mcActionGame.getTrackNode(m_iLastNode + _root.mcActionGame.m_iNodeSteps);
var _local14 = _local13.x - _local10.x;
var _local15 = _local13.y - _local10.y;
if (m_immuneToCollision <= 0) {
m_fNeedAngle1_bot = _global.vecGetAngle(1, 0, _local14, _local15);
}
if (m_iBlockControlTime > 0) {
m_iBlockControlTime--;
}
m_iTimeFromLastCollision++;
if (m_bIsNitroEffect && (m_bIsNitroIncSpeed)) {
carChangeSpeed(m_acc1 * 4);
if (carGetSpeed() >= m_iNitroMaxSpeed) {
m_bIsNitroIncSpeed = false;
carSetSpeed(m_iNitroMaxSpeed);
}
}
if (carGetSpeed() == 0) {
carStopWheel();
} else {
carPlayWheel();
}
switch (m_iAIType) {
case 1 :
carThink_Player();
if (_global.gameMode == 2) {
_root.mcActionGame.gameSavePositionForShadowCar(m_fX, m_fY, m_fAngle, m_fWheelAngle, m_iLastNode);
}
break;
case 2 :
carThink_ShadowBot();
break;
case 0 :
default :
carThink_Bot();
}
carUpdateLap();
carSetMovieClip();
if (m_arLastCollision.length != 0) {
m_iPointFlashTime--;
if (m_iPointFlashTime <= 0) {
m_iPointFlashTime = 6;
_local6 = 0;
while (_local6 < m_arLastCollision.length) {
var _local8 = m_arLastCollision[_local6].indx;
var _local4 = m_mcObj["c" + _local8];
_local4._xscale = (_local4._yscale = 20);
if (_local4._alpha == 0) {
_local4._alpha = 100;
} else {
_local4._alpha = 0;
}
_local6++;
}
}
}
m_mcObj.stop_sign._visible = false;
if (m_iAIType == 1) {
if ((carGetSpeed() >= (m_max_speed1 * 0.7)) && (m_fWheelAngle != 0)) {
carAddSled("bWheel1", 0);
carAddSled("bWheel2", 1);
}
var _local9 = carGetWheelGlobalPos("bWheel1");
m_fLastSledX[0] = _local9.x;
m_fLastSledY[0] = _local9.y;
_local9 = carGetWheelGlobalPos("bWheel2");
m_fLastSledX[1] = _local9.x;
m_fLastSledY[1] = _local9.y;
}
}
function carGetWheelGlobalPos(wheel_name) {
var _local5 = m_mcObj[wheel_name]._x;
var _local4 = m_mcObj[wheel_name]._y;
var _local3 = {x:_local5, y:_local4};
m_mcObj.localToGlobal(_local3);
_root.mcActionGame.m_mcTrack.globalToLocal(_local3);
return(_local3);
}
function carAddSled(wheel_name, wheel_index) {
var _local3 = carGetWheelGlobalPos(wheel_name);
var sled = _root.mcActionGame.m_mcTrack.sledClip.createEmptyMovieClip("sled_mc", _root.mcActionGame.m_mcTrack.sledClip.getNextHighestDepth());
sled.lineStyle(16, 0, 30, false, "none", "none", "round", 1);
sled.moveTo(m_fLastSledX[wheel_index], m_fLastSledY[wheel_index]);
sled.lineTo(_local3.x, _local3.y);
sled.waitBeforeFade = 48;
sled.onEnterFrame = function () {
if (sled.waitBeforeFade > 0) {
sled.waitBeforeFade--;
} else {
this._alpha = this._alpha - 4;
}
if (this._alpha <= 0) {
this.removeMovieClip();
}
};
m_fLastSledX[wheel_index] = _local3.x;
m_fLastSledY[wheel_index] = _local3.y;
}
function carThink_Player() {
var _local20 = m_friction1;
var _local5 = m_wheel_omega1;
var _local3 = m_max_wheel_ang1;
var _local4 = m_acc1;
var _local16 = m_max_speed1;
var _local9 = m_dir_omega1;
var _local17 = m_min_speed_for_rotate1;
var _local14 = m_speed_for_break_when_rotate1;
var _local12 = m_add_friction_min1;
var _local21 = m_add_friction_max1;
var _local10 = m_speed_add_friction_min1;
var _local18 = m_speed_add_friction_max1;
var _local19 = m_collision_speed_lost_coeff1;
var _local11 = m_block_control_time1;
var _local22 = m_min_speed_for_drift1;
var _local23 = m_min_wheel_angle_for_drift1;
var _local13 = m_max_wheel_angle_for_drift1;
var _local8 = m_drift_coeff_min1;
var _local15 = m_drift_coeff_max1;
if (Key.isDown(37) && (m_iBlockControlTime <= 0)) {
m_fWheelAngle = m_fWheelAngle - _local5;
if (m_fWheelAngle < (-_local3)) {
m_fWheelAngle = -_local3;
}
} else if (Key.isDown(39) && (m_iBlockControlTime <= 0)) {
m_fWheelAngle = m_fWheelAngle + _local5;
if (m_fWheelAngle > _local3) {
m_fWheelAngle = _local3;
}
}
if (Key.isDown(38) && (m_iBlockControlTime <= 0)) {
if (!m_bIsNitroEffect) {
var _local7 = carGetSpeed();
carChangeSpeed(_local4);
if ((_local7 <= 0) && (carGetSpeed() > 0)) {
_global.playSound("sndEngine");
}
}
} else if (Key.isDown(40) && (m_iBlockControlTime <= 0)) {
carChangeSpeed(-_local4);
}
carCalculateMove();
var _local6 = carCalculateCollisionsAndReactions();
if (m_bIsCollisionInPreFrame && (_local6)) {
m_iNumFramesInStack++;
} else {
m_iNumFramesInStack = 0;
}
m_bIsCollisionInPreFrame = _local6;
if (m_iNumFramesInStack >= 24) {
m_fX = m_fNodeX;
m_fY = m_fNodeY;
carSetSpeed(0);
}
}
function carThink_ShadowBot() {
var _local3 = _root.mcActionGame.gameGetNextSavedPosition();
if (_local3 == null) {
return(undefined);
}
m_fX = _local3.x;
m_fY = _local3.y;
m_fAngle = _local3.angle;
m_fWheelAngle = _local3.wangle;
m_iLastNode = _local3.node;
m_iCurLap = 1;
}
function carThink_Bot() {
var _local24 = m_friction1;
var _local16 = m_wheel_omega1;
var _local15 = m_max_wheel_ang1;
var _local9 = m_acc1;
var _local21 = m_max_speed1;
var _local5 = m_dir_omega1;
var _local11 = m_min_speed_for_rotate1;
var _local19 = m_speed_for_break_when_rotate1;
var _local17 = m_add_friction_min1;
var _local25 = m_add_friction_max1;
var _local13 = m_speed_add_friction_min1;
var _local22 = m_speed_add_friction_max1;
var _local23 = m_collision_speed_lost_coeff1;
var _local14 = m_block_control_time1;
var _local26 = m_min_speed_for_drift1;
var _local27 = m_min_wheel_angle_for_drift1;
var _local18 = m_max_wheel_angle_for_drift1;
var _local12 = m_drift_coeff_min1;
var _local20 = m_drift_coeff_max1;
if (m_iBlockControlTime <= 0) {
m_bIsIgnoreCollision = false;
if (m_iBotAfterCollisionTime > 0) {
m_fNeedAngle1_bot = _global.vecGetAngle(1, 0, m_fNodeX - m_fX, m_fNodeY - m_fY);
m_iBotAfterCollisionTime--;
m_bIsIgnoreCollision = true;
}
var _local10 = Math.abs(m_fNeedAngle1_bot - m_fAngle);
if ((_local10 > 5) && (Math.abs(carGetSpeed()) >= _local11)) {
var _local3 = m_fAngle;
var _local4 = m_fNeedAngle1_bot;
if (_local3 < 0) {
_local3 = 360 + _local3;
}
if (_local4 < 0) {
_local4 = 360 + _local4;
}
var _local7 = Math.abs(_local4 - _local3);
var _local8 = 360 - _local7;
if (_local7 < _local8) {
if (_local3 > _local4) {
_local3 = _local3 - _local5;
if (_local3 < 0) {
_local3 = _local3 + 360;
}
if (_local3 < _local4) {
_local3 = _local4;
}
} else if (_local3 < _local4) {
_local3 = _local3 + _local5;
if (_local3 >= 360) {
_local3 = _local3 - 360;
}
if (_local3 > _local4) {
_local3 = _local4;
}
}
} else if (_local7 > _local8) {
if (_local3 > _local4) {
_local3 = _local3 + _local5;
if (_local3 >= 360) {
_local3 = _local3 - 360;
}
if (_local3 < _local4) {
_local3 = _local4;
}
} else if (_local3 < _local4) {
_local3 = _local3 - _local5;
if (_local3 < 0) {
_local3 = _local3 + 360;
}
if (_local3 > _local4) {
_local3 = _local4;
}
}
}
if (_local3 > 180) {
_local3 = _local3 - 360;
}
m_fAngle = _local3;
}
if (!m_bIsNitroEffect) {
carChangeSpeed(_local9);
}
}
carCalculateMove();
var _local6 = carCalculateCollisionsAndReactions();
if (m_bIsCollisionInPreFrame && (_local6)) {
m_iNumFramesInStack++;
} else {
m_iNumFramesInStack = 0;
}
m_bIsCollisionInPreFrame = _local6;
if (_local6) {
m_iBotAfterCollisionTime = 24;
}
if (m_iNumFramesInStack >= 24) {
m_fX = m_fNodeX;
m_fY = m_fNodeY;
carSetSpeed(0);
}
}
function carSetPhysicSettings(obj) {
if (obj.drivername != undefined) {
m_drivername = obj.drivername;
}
if (obj.carname != undefined) {
m_carname = obj.carname;
}
if (obj.friction1 != undefined) {
m_friction1 = obj.friction1;
}
if (obj.wheel_omega1 != undefined) {
m_wheel_omega1 = obj.wheel_omega1;
}
if (obj.max_wheel_ang1 != undefined) {
m_max_wheel_ang1 = obj.max_wheel_ang1;
}
if (obj.acc1 != undefined) {
m_acc1 = obj.acc1;
}
if (obj.max_speed1 != undefined) {
m_max_speed1 = obj.max_speed1;
}
if (obj.dir_omega1 != undefined) {
m_dir_omega1 = obj.dir_omega1;
}
if (obj.min_speed_for_rotate1 != undefined) {
m_min_speed_for_rotate1 = obj.min_speed_for_rotate1;
}
if (obj.speed_for_break_when_rotate1 != undefined) {
m_speed_for_break_when_rotate1 = obj.speed_for_break_when_rotate1;
}
if (obj.add_friction_min1 != undefined) {
m_add_friction_min1 = obj.add_friction_min1;
}
if (obj.add_friction_max1 != undefined) {
m_add_friction_max1 = obj.add_friction_max1;
}
if (obj.speed_add_friction_min1 != undefined) {
m_speed_add_friction_min1 = obj.speed_add_friction_min1;
}
if (obj.speed_add_friction_max1 != undefined) {
m_speed_add_friction_max1 = obj.speed_add_friction_max1;
}
if (obj.collision_speed_lost_coeff1 != undefined) {
m_collision_speed_lost_coeff1 = obj.collision_speed_lost_coeff1;
}
if (obj.block_control_time1 != undefined) {
m_block_control_time1 = obj.block_control_time1;
}
if (obj.min_speed_for_drift1 != undefined) {
m_min_speed_for_drift1 = obj.min_speed_for_drift1;
}
if (obj.min_wheel_angle_for_drift1 != undefined) {
m_min_wheel_angle_for_drift1 = obj.min_wheel_angle_for_drift1;
}
if (obj.max_wheel_angle_for_drift1 != undefined) {
m_max_wheel_angle_for_drift1 = obj.max_wheel_angle_for_drift1;
}
if (obj.drift_coeff_min1 != undefined) {
m_drift_coeff_min1 = obj.drift_coeff_min1;
}
if (obj.drift_coeff_max1 != undefined) {
m_drift_coeff_max1 = obj.drift_coeff_max1;
}
m_iNitroMaxSpeed = m_max_speed1 + (m_max_speed1 * 0.3);
}
function getVel() {
var _local3 = carGetSpeed();
_local3 = _global.roundTo(_local3, 0.01);
return(_local3);
}
function carSetAIType(ai) {
m_iAIType = ai;
}
function carGetAIType() {
return(m_iAIType);
}
function carSetMovieClip() {
m_mcObj._x = m_fX;
m_mcObj._y = m_fY;
m_mcObj._rotation = m_fAngle;
if (m_mcArrow) {
m_mcArrow._x = m_fX;
m_mcArrow._y = m_fY;
m_mcArrow._rotation = m_fNeedAngle1_bot;
}
m_mcObj.fWheel1._rotation = m_fWheelAngle;
m_mcObj.fWheel2._rotation = m_fWheelAngle;
if (m_iAIType == 0) {
m_mcObj.fWheel1._rotation = m_fFakeWheelAngle;
m_mcObj.fWheel2._rotation = m_fFakeWheelAngle;
}
}
function carDelete() {
m_mcObj.removeMovieClip();
if (m_mcArrow) {
m_mcArrow.removeMovieClip();
}
}
function carUpdateLap() {
var _local4 = m_iLastNode;
var _local8 = _root.mcActionGame.getNearestNodeIndex(m_fX, m_fY, m_iLastNode);
var _local6 = 20;
var _local5 = 100;
if ((_local4 > _local5) && (_local8 < _local6)) {
m_iRowLap++;
} else if ((_local4 < _local6) && (_local8 > _local5)) {
m_iRowLap--;
}
if (m_iRowLap > m_iCurLap) {
m_iCurLap = m_iRowLap;
if (m_iAIType == 0) {
m_fAngle = m_fStartAngle;
}
if (m_iCurLap > 1) {
if (m_iBestLap > m_iLapTime) {
m_iBestLap = m_iLapTime;
}
if (m_iAIType == 1) {
var _local9 = (("lap " + m_iCurLap) + " of ") + _root.mcActionGame.m_iMaxNumLap;
if (m_iCurLap == _root.mcActionGame.m_iMaxNumLap) {
_local9 = "LAST LAP";
}
trace("lap time " + _global.formTimeStr(m_iLapTime));
trace("best time " + _global.formTimeStr(m_iBestLap));
if (m_iCurLap == (_root.mcActionGame.m_iMaxNumLap + 1)) {
_root.mcActionGame.gameEndRace();
} else {
_root.mcGUI.mcLastLap._visible = true;
_root.mcGUI.mcLastLap.gotoAndPlay(2);
var _local7 = m_iCurLap - 1;
if (m_iCurLap == _root.mcActionGame.m_iMaxNumLap) {
_local7 = 4;
}
_root.mcGUI.mcLastLap.msg.gotoAndStop(_local7);
_root.mcActionGame.gameResetAllBonuses();
_global.playSound("sndCount2");
}
}
}
m_iLapTime = 0;
m_iTimeStart = getTimer();
}
}
function carSimpleCollisionTest(hitClip, points, bIsWithShape) {
var _local3 = false;
var _local1 = 0;
while (_local1 < points.length) {
_local3 = hitClip.hitTest(points[_local1].x, points[_local1].y, bIsWithShape);
if (_local3) {
break;
}
_local1++;
}
return(_local3);
}
function carCollisionTest(hitClip, points, bIsWithShape, rpoints) {
var _local1 = 0;
while (_local1 < points.length) {
var _local3 = hitClip.hitTest(points[_local1].x, points[_local1].y, bIsWithShape);
if (!_local3) {
} else {
rpoints.push(points[_local1]);
}
_local1++;
}
}
function carPrepareCollisionPoints(points_array) {
var _local2 = 0;
while (m_mcObj["c" + _local2] != undefined) {
var _local4 = m_mcObj["c" + _local2];
var _local3 = {x:_local4._x, y:_local4._y, indx:_local2};
m_mcObj.localToGlobal(_local3);
points_array.push(_local3);
_local2++;
}
}
function carShowHideCollisionPoints() {
var _local2 = 0;
while (m_mcObj["c" + _local2] != undefined) {
var _local3 = m_mcObj["c" + _local2];
_local3._visible = !_local3._visible;
_local2++;
}
}
function carCalculateMove() {
var _local7 = m_friction1;
var _local30 = m_wheel_omega1;
var _local29 = m_max_wheel_ang1;
var _local19 = m_acc1;
var _local31 = m_max_speed1;
var _local3 = m_dir_omega1;
var _local24 = m_min_speed_for_rotate1;
var _local22 = m_speed_for_break_when_rotate1;
var _local14 = m_add_friction_min1;
var _local16 = m_add_friction_max1;
var _local10 = m_speed_add_friction_min1;
var _local6 = m_speed_add_friction_max1;
var _local32 = m_collision_speed_lost_coeff1;
var _local28 = m_block_control_time1;
var _local26 = m_min_speed_for_drift1;
var _local18 = m_min_wheel_angle_for_drift1;
var _local9 = m_max_wheel_angle_for_drift1;
var _local20 = m_drift_coeff_min1;
var _local23 = m_drift_coeff_max1;
var _local15 = Math.abs(carGetSpeed());
if ((_local15 > _local24) && (m_fWheelAngle != 0)) {
if (_local15 >= _local22) {
_local7 = _local19;
if ((carGetSpeed() >= _local10) && (carGetSpeed() <= _local6)) {
_local7 = _local7 + _global.lineInterpolation(_local14, _local16, _local10, _local6, carGetSpeed());
} else if (carGetSpeed() > _local6) {
_local7 = _local7 + _global.lineInterpolation(_local14, _local16, _local10, _local6, _local6);
}
}
if (m_fWheelAngle > 0) {
if (carGetSpeed() > 0) {
m_fAngle = m_fAngle + _local3;
} else {
m_fAngle = m_fAngle - _local3;
}
m_fWheelAngle = m_fWheelAngle - _local3;
if (m_fWheelAngle < 0) {
m_fWheelAngle = 0;
}
} else if (m_fWheelAngle < 0) {
if (carGetSpeed() > 0) {
m_fAngle = m_fAngle - _local3;
} else {
m_fAngle = m_fAngle + _local3;
}
m_fWheelAngle = m_fWheelAngle + _local3;
if (m_fWheelAngle > 0) {
m_fWheelAngle = 0;
}
}
}
var _local17 = (m_fAngle / 180) * Math.PI;
var _local12 = Math.cos(_local17);
var _local11 = Math.sin(_local17);
var _local25 = _global.vecGetAngle(1, 0, _local12, _local11);
m_fAngle = _local25;
var _local8 = new CVector2D();
_local8.setVector(_local12, _local11);
_local8.Rotate(90);
var _local4 = 0;
if (carGetSpeed() >= _local26) {
var _local5 = Math.abs(m_fWheelAngle);
if (_local5 > _local9) {
_local5 = _local9;
}
if ((_local5 >= _local18) && (_local5 <= _local9)) {
_local4 = _global.lineInterpolation(_local20, _local23, _local18, _local9, _local5);
}
}
var _local13 = 1 - _local4;
if (m_fWheelAngle > 0) {
_local4 = -_local4;
}
if (carGetSpeed() > 0) {
carChangeSpeed(-_local7);
if (carGetSpeed() < 0) {
carSetSpeed(0);
}
} else if (carGetSpeed() < 0) {
carChangeSpeed(_local7);
if (carGetSpeed() > 0) {
carSetSpeed(0);
}
}
var _local21 = carGetSpeed() * ((_local13 * _local12) + (_local4 * _local8.m_fX));
var _local27 = carGetSpeed() * ((_local13 * _local11) + (_local4 * _local8.m_fY));
m_fX = m_fX + _local21;
m_fY = m_fY + _local27;
carSetMovieClip();
}
function carCalculateCollisionsAndReactions() {
if (m_bIsIgnoreCollision) {
return(false);
}
var _local26 = m_friction1;
var _local18 = m_wheel_omega1;
var _local17 = m_max_wheel_ang1;
var _local13 = m_acc1;
var _local23 = m_max_speed1;
var _local15 = m_dir_omega1;
var _local24 = m_min_speed_for_rotate1;
var _local21 = m_speed_for_break_when_rotate1;
var _local19 = m_add_friction_min1;
var _local27 = m_add_friction_max1;
var _local16 = m_speed_add_friction_min1;
var _local25 = m_speed_add_friction_max1;
var _local11 = m_collision_speed_lost_coeff1;
var _local10 = m_block_control_time1;
var _local28 = m_min_speed_for_drift1;
var _local29 = m_min_wheel_angle_for_drift1;
var _local20 = m_max_wheel_angle_for_drift1;
var _local14 = m_drift_coeff_min1;
var _local22 = m_drift_coeff_max1;
var _local8 = new Array();
carPrepareCollisionPoints(_local8);
var _local6 = 0;
while (_local6 < _root.mcActionGame.m_arDObj.length) {
var _local5 = _root.mcActionGame.m_arDObj[_local6];
if (_local5.dead) {
} else if (carSimpleCollisionTest(_local5, _local8, true) == false) {
} else {
_local5.gotoAndPlay("die");
_local5.dead = true;
if (_root.mcActionGame.gameIsOnScreen(m_fX, m_fY)) {
_global.playSound("sndDestroy");
}
}
_local6++;
}
_local6 = 0;
while (_root.mcActionGame.m_mcTrack["b" + _local6] != undefined) {
var _local4 = _root.mcActionGame.m_mcTrack["b" + _local6];
if (_local4.dead) {
} else if (carSimpleCollisionTest(_local4, _local8, true) == false) {
} else {
_local4.dead = true;
_local4.gotoAndPlay("die");
carBonusTaken(_local4.bonus_type);
}
_local6++;
}
if (_global.track_collision_on == false) {
return(undefined);
}
var _local9 = new Array();
var _local12 = _root.mcActionGame.getHitClip();
carCollisionTest(_local12, _local8, true, _local9);
if (_local9.length == 0) {
return(false);
}
m_fX = m_fPreX;
m_fY = m_fPreY;
m_fAngle = m_fPreAngle;
carSetSpeed((-carGetSpeed()) * _local11);
m_iBlockControlTime = _local10;
if (_root.mcActionGame.gameIsOnScreen(m_fX, m_fY) && (m_iTimeFromLastCollision > 24)) {
_global.playSound("sndCrash");
}
m_iTimeFromLastCollision = 0;
if (m_iAIType == 0) {
_root.mcActionGame.m_iNumBotCollisions++;
}
delete m_arLastCollision;
m_arLastCollision = new Array();
_local6 = 0;
while (_local6 < _local9.length) {
m_arLastCollision.push(_local9[_local6]);
_local6++;
}
_local6 = 0;
while (m_mcObj["c" + _local6] != undefined) {
var _local7 = m_mcObj["c" + _local6];
_local7._xscale = (_local7._yscale = 10);
_local7._alpha = 100;
_local6++;
}
return(true);
}
function carStopWheel() {
m_mcObj.fWheel1.wbody.stop();
m_mcObj.fWheel2.wbody.stop();
m_mcObj.bWheel1.wbody.stop();
m_mcObj.bWheel2.wbody.stop();
}
function carPlayWheel() {
m_mcObj.fWheel1.wbody.play();
m_mcObj.fWheel2.wbody.play();
m_mcObj.bWheel1.wbody.play();
m_mcObj.bWheel2.wbody.play();
}
function carBonusTaken(bonus_type) {
trace(("try to take bonus " + bonus_type) + "...");
if ((bonus_type < 0) || (bonus_type > 1)) {
trace("unknow bonus!");
return(undefined);
}
var _local7 = false;
var _local4 = 0;
while (_local4 < m_iActiveBonusType.length) {
if (m_iActiveBonusType[_local4] != bonus_type) {
} else {
m_iActiveBonusTime[_local4] = _global.bonusTime[bonus_type];
if (m_iAIType == 1) {
_root.mcGUI["bonus_slot" + (_local4 + 1)]._visible = true;
_root.mcGUI["bonus_slot" + (_local4 + 1)].flash_time = 0;
}
_local7 = true;
trace(("this bonus is already taken(index = " + _local4) + "). Update it time.");
break;
}
_local4++;
}
if (_local7) {
return(undefined);
}
var _local6 = -1;
trace("try to find free slot...");
_local4 = 0;
while (_local4 < m_iActiveBonusType.length) {
if (m_iActiveBonusType[_local4] >= 0) {
} else {
_local6 = _local4;
break;
}
_local4++;
}
if (_local6 < 0) {
trace("too many bonuses is already active! Can't take new one!");
return(undefined);
}
trace("Add bonus in slot with index " + _local6);
m_iActiveBonusType[_local6] = bonus_type;
m_iActiveBonusTime[_local6] = _global.bonusTime[bonus_type];
switch (bonus_type) {
case 0 :
m_bIsNitroEffect = true;
m_bIsNitroIncSpeed = true;
carSetSpeed(m_max_speed1 + 1);
m_mcObj.turbo._visible = true;
if (m_iAIType == 1) {
_root.mcGUI.mcLastLap._visible = true;
_root.mcGUI.mcLastLap.gotoAndPlay(2);
_root.mcGUI.mcLastLap.msg.gotoAndStop(5);
_global.playSound("sndNitroStart");
}
break;
case 1 :
m_speed_for_break_when_rotate1 = m_speed_for_break_when_rotate1 * 1000;
break;
}
if (m_iAIType == 1) {
_root.mcGUI["bonus_slot" + (_local6 + 1)]._visible = true;
_root.mcGUI["bonus_slot" + (_local6 + 1)].gotoAndStop(_global.bonusNames[bonus_type]);
_root.mcGUI["bonus_slot" + (_local6 + 1)].flash_time = 0;
}
}
function carBonusDrop(bonus_index) {
if ((bonus_index < 0) || (bonus_index > (m_iActiveBonusType.length - 1))) {
return(undefined);
}
if ((m_iActiveBonusType[bonus_index] < 0) || (m_iActiveBonusType[bonus_index] > 1)) {
return(undefined);
}
var _local5 = m_iActiveBonusType[bonus_index];
switch (_local5) {
case 0 :
m_bIsNitroEffect = false;
m_bIsNitroIncSpeed = false;
m_mcObj.turbo._visible = false;
break;
case 1 :
m_speed_for_break_when_rotate1 = m_speed_for_break_when_rotate1 / 1000;
break;
}
trace((("Drop bonus " + m_iActiveBonusType[bonus_index]) + " at slot ") + bonus_index);
m_iActiveBonusType[bonus_index] = -1;
m_iActiveBonusTime[bonus_index] = 0;
if (m_iAIType == 1) {
_root.mcGUI["bonus_slot" + (bonus_index + 1)]._visible = false;
_root.mcGUI["bonus_slot" + (bonus_index + 1)].flash_time = 0;
_global.playSound("sndNitroEnd");
}
}
function carBonusDropAll() {
var _local2 = 0;
while (_local2 < m_iActiveBonusType.length) {
carBonusDrop(m_iActiveBonusType[_local2]);
_local2++;
}
}
function carChangeSpeed(acc) {
var _local2 = m_fSpeed1 + acc;
carSetSpeed(_local2);
}
function carSetSpeed(new_speed) {
var _local3 = m_max_speed1;
m_fSpeed1 = new_speed;
if (m_fSpeed1 > _local3) {
if (!m_bIsNitroEffect) {
m_fSpeed1 = _local3;
}
} else if (m_fSpeed1 < (-_local3)) {
m_fSpeed1 = -_local3;
}
if (m_bIsNitroEffect && (m_fSpeed1 <= _local3)) {
var _local2 = 0;
while (_local2 < m_iActiveBonusType.length) {
if (m_iActiveBonusType[_local2] != 0) {
} else {
carBonusDrop(_local2);
break;
}
_local2++;
}
}
}
function carGetSpeed() {
return(m_fSpeed1);
}
function setStartPointName(sp_name) {
m_spName = sp_name;
}
function setCarClipName(nm) {
m_mcCarName = nm;
}
function getCarClipName() {
return(m_mcCarName);
}
var m_iAIType = 0;
var m_mcObj = null;
var m_mcArrow = null;
var m_fX = 0;
var m_fY = 0;
var m_fAngle = 0;
var m_fPreX = 0;
var m_fPreY = 0;
var m_fPreAngle = 0;
var m_fWheelAngle = 0;
var m_fStartX = 0;
var m_fStartY = 0;
var m_fStartAngle = 0;
var m_iLiveFrames = 0;
var m_iBlockControlTime = 0;
var m_iCurLap = 0;
var m_iRowLap = 0;
var m_iPointFlashTime = 0;
var m_fNodeX = -1;
var m_fNodeY = -1;
var m_iLastNode = -1;
var m_bIsCollisionInPreFrame = false;
var m_iNumFramesInStack = 0;
var m_iBotAfterCollisionTime = 0;
var m_fFakeWheelAngle = 0;
var m_iCurPlace = 1;
var m_iBestLap = 100000;
var m_iLapTime = 0;
var m_iTimeStart = 0;
var m_fSpeed1 = 0;
var m_drivername = "unknow";
var m_carname = "unknow";
var m_friction1 = 0.25;
var m_wheel_omega1 = 6;
var m_max_wheel_ang1 = 30;
var m_acc1 = 0.75;
var m_max_speed1 = 15;
var m_dir_omega1 = 4;
var m_min_speed_for_rotate1 = 3;
var m_speed_for_break_when_rotate1 = 3;
var m_add_friction_min1 = 0.25;
var m_add_friction_max1 = 0.25;
var m_speed_add_friction_min1 = 8;
var m_speed_add_friction_max1 = 15;
var m_collision_speed_lost_coeff1 = 0.5;
var m_block_control_time1 = 12;
var m_min_speed_for_drift1 = 1000;
var m_min_wheel_angle_for_drift1 = 40;
var m_max_wheel_angle_for_drift1 = 40;
var m_drift_coeff_min1 = 0;
var m_drift_coeff_max1 = 0;
var m_fNeedAngle1_bot = 0;
var m_bIsIgnoreCollision = false;
}
Symbol 86 MovieClip [mcBonus] Frame 1
stop();
Symbol 86 MovieClip [mcBonus] Frame 21
stop();
Symbol 626 Button
on (press) {
onNewGame();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 631 Button
on (press) {
onHelp();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 636 Button
on (press) {
onMoreFreeGames();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 638 Button
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
Symbol 640 Button
on (press) {
this._parent.soundOn();
this.gotoAndStop(1);
}
Symbol 641 MovieClip Frame 1
this.stop();
_root.mcMusic.gotoAndPlay("start_1");
_global.enableSound(true);
Symbol 641 MovieClip Frame 2
this.stop();
_root.mcMusic.gotoAndPlay("stop_1");
_global.enableSound(false);
Symbol 648 Button
on (press) {
onMainMenu_Help();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 653 Button
on (press) {
onChampionship();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 658 Button
on (press) {
onShadowRace();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 663 Button
on (press) {
onTrial();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 664 Button
on (press) {
onMainMenu_SelectGame();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 669 Button
on (press) {
onSingleRace();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 684 MovieClip Frame 1
stop();
Instance of Symbol 678 MovieClip "border_clip" in Symbol 684 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 684 MovieClip Frame 2
stop();
Symbol 684 MovieClip Frame 3
stop();
Symbol 684 MovieClip Frame 4
stop();
Symbol 684 MovieClip Frame 5
stop();
Symbol 684 MovieClip Frame 6
stop();
Symbol 685 Button
on (press) {
onMainMenu_SelectTrack();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 686 MovieClip Frame 1
stop();
Symbol 686 MovieClip Frame 11
stop();
Symbol 686 MovieClip Frame 21
stop();
Symbol 686 MovieClip Frame 31
stop();
Instance of Symbol 684 MovieClip in Symbol 686 MovieClip Frame 31
onClipEvent (load) {
gotoAndStop (1);
this.decAlpha = false;
}
on (press) {
onSelectTrack1();
}
on (rollOver) {
_global.playSound("sndButton");
this.border_clip._visible = true;
this.decAlpha = true;
}
onClipEvent (enterFrame) {
if (this.decAlpha && (this.fade._alpha > 0)) {
this.fade._alpha = this.fade._alpha - 5;
if (this.fade._alpha < 0) {
this.fade._alpha = 0;
}
} else if ((!this.decAlpha) && (this.fade._alpha < 70)) {
this.fade._alpha = this.fade._alpha + 10;
if (this.fade._alpha > 70) {
this.fade._alpha = 70;
}
}
}
on (rollOut) {
this.border_clip._visible = false;
this.decAlpha = false;
}
Instance of Symbol 684 MovieClip in Symbol 686 MovieClip Frame 31
onClipEvent (load) {
gotoAndStop (4);
this.decAlpha = false;
}
on (press) {
onSelectTrack4();
}
on (rollOver) {
_global.playSound("sndButton");
this.border_clip._visible = true;
this.decAlpha = true;
}
onClipEvent (enterFrame) {
if (this.decAlpha && (this.fade._alpha > 0)) {
this.fade._alpha = this.fade._alpha - 5;
if (this.fade._alpha < 0) {
this.fade._alpha = 0;
}
} else if ((!this.decAlpha) && (this.fade._alpha < 70)) {
this.fade._alpha = this.fade._alpha + 10;
if (this.fade._alpha > 70) {
this.fade._alpha = 70;
}
}
}
on (rollOut) {
this.border_clip._visible = false;
this.decAlpha = false;
}
Instance of Symbol 684 MovieClip in Symbol 686 MovieClip Frame 31
onClipEvent (load) {
gotoAndStop (2);
this.decAlpha = false;
}
on (press) {
onSelectTrack2();
}
on (rollOver) {
_global.playSound("sndButton");
this.border_clip._visible = true;
this.decAlpha = true;
}
onClipEvent (enterFrame) {
if (this.decAlpha && (this.fade._alpha > 0)) {
this.fade._alpha = this.fade._alpha - 5;
if (this.fade._alpha < 0) {
this.fade._alpha = 0;
}
} else if ((!this.decAlpha) && (this.fade._alpha < 70)) {
this.fade._alpha = this.fade._alpha + 10;
if (this.fade._alpha > 70) {
this.fade._alpha = 70;
}
}
}
on (rollOut) {
this.border_clip._visible = false;
this.decAlpha = false;
}
Instance of Symbol 684 MovieClip in Symbol 686 MovieClip Frame 31
onClipEvent (load) {
gotoAndStop (5);
this.decAlpha = false;
}
on (press) {
onSelectTrack5();
}
on (rollOver) {
_global.playSound("sndButton");
this.border_clip._visible = true;
this.decAlpha = true;
}
onClipEvent (enterFrame) {
if (this.decAlpha && (this.fade._alpha > 0)) {
this.fade._alpha = this.fade._alpha - 5;
if (this.fade._alpha < 0) {
this.fade._alpha = 0;
}
} else if ((!this.decAlpha) && (this.fade._alpha < 70)) {
this.fade._alpha = this.fade._alpha + 10;
if (this.fade._alpha > 70) {
this.fade._alpha = 70;
}
}
}
on (rollOut) {
this.border_clip._visible = false;
this.decAlpha = false;
}
Instance of Symbol 684 MovieClip in Symbol 686 MovieClip Frame 31
onClipEvent (load) {
gotoAndStop (3);
this.decAlpha = false;
}
on (press) {
onSelectTrack3();
}
on (rollOver) {
_global.playSound("sndButton");
this.border_clip._visible = true;
this.decAlpha = true;
}
onClipEvent (enterFrame) {
if (this.decAlpha && (this.fade._alpha > 0)) {
this.fade._alpha = this.fade._alpha - 5;
if (this.fade._alpha < 0) {
this.fade._alpha = 0;
}
} else if ((!this.decAlpha) && (this.fade._alpha < 70)) {
this.fade._alpha = this.fade._alpha + 10;
if (this.fade._alpha > 70) {
this.fade._alpha = 70;
}
}
}
on (rollOut) {
this.border_clip._visible = false;
this.decAlpha = false;
}
Instance of Symbol 684 MovieClip in Symbol 686 MovieClip Frame 31
onClipEvent (load) {
gotoAndStop (6);
this.decAlpha = false;
}
on (press) {
onSelectTrack6();
}
on (rollOver) {
_global.playSound("sndButton");
this.border_clip._visible = true;
this.decAlpha = true;
}
onClipEvent (enterFrame) {
if (this.decAlpha && (this.fade._alpha > 0)) {
this.fade._alpha = this.fade._alpha - 5;
if (this.fade._alpha < 0) {
this.fade._alpha = 0;
}
} else if ((!this.decAlpha) && (this.fade._alpha < 70)) {
this.fade._alpha = this.fade._alpha + 10;
if (this.fade._alpha > 70) {
this.fade._alpha = 70;
}
}
}
on (rollOut) {
this.border_clip._visible = false;
this.decAlpha = false;
}
Symbol 687 MovieClip [mcActionMenu] Frame 1
#initclip 5
Object.registerClass("mcActionMenu", CActionMenu);
#endinitclip
Instance of Symbol 3 MovieClip in Symbol 687 MovieClip [mcActionMenu] Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 697 MovieClip Frame 1
stop();
Symbol 697 MovieClip Frame 10
gotoAndStop (1);
Symbol 697 MovieClip Frame 25
gotoAndStop (1);
Symbol 697 MovieClip Frame 35
gotoAndStop (1);
Symbol 697 MovieClip Frame 46
gotoAndStop (1);
Symbol 697 MovieClip Frame 57
gotoAndStop (1);
Symbol 697 MovieClip Frame 65
gotoAndStop (1);
Symbol 697 MovieClip Frame 73
gotoAndStop (1);
Symbol 697 MovieClip Frame 82
gotoAndStop (1);
Symbol 697 MovieClip Frame 93
gotoAndStop (1);
Symbol 697 MovieClip Frame 103
gotoAndStop (1);
Symbol 699 MovieClip Frame 1
stop();
Symbol 699 MovieClip Frame 12
gotoAndStop (1);
Symbol 699 MovieClip Frame 25
gotoAndStop (1);
Symbol 700 MovieClip [mcActionGame] Frame 1
#initclip 6
Object.registerClass("mcActionGame", CActionGame);
#endinitclip
Instance of Symbol 3 MovieClip in Symbol 700 MovieClip [mcActionGame] Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 710 MovieClip Frame 1
_root.car._alpha = 0;
Symbol 710 MovieClip Frame 11
_root.car._alpha = 100;
Symbol 711 MovieClip Frame 20
_global.playSound("sndCount1");
Symbol 711 MovieClip Frame 42
_global.playSound("sndCount1");
Symbol 711 MovieClip Frame 66
_global.playSound("sndCount1");
Symbol 711 MovieClip Frame 88
_global.playSound("sndCount2");
Symbol 711 MovieClip Frame 106
stop();
Symbol 718 MovieClip Frame 1
stop();
Symbol 718 MovieClip Frame 16
stop();
Symbol 732 MovieClip Frame 1
stop();
Symbol 732 MovieClip Frame 2
stop();
Symbol 732 MovieClip Frame 3
stop();
Symbol 732 MovieClip Frame 4
stop();
Symbol 732 MovieClip Frame 5
stop();
Symbol 732 MovieClip Frame 6
stop();
Symbol 743 MovieClip Frame 1
stop();
Symbol 743 MovieClip Frame 2
stop();
Symbol 743 MovieClip Frame 3
stop();
Symbol 743 MovieClip Frame 4
stop();
Symbol 743 MovieClip Frame 5
stop();
Symbol 744 MovieClip Frame 1
stop();
Symbol 757 Button
on (press) {
onMoreFreeGames();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 760 Button
on (press) {
onMainMenu_Pause();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 765 Button
on (press) {
onPause_Restart();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 770 Button
on (press) {
onPause_Resume();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 779 Button
on (press) {
onOk_LevelStatistic();
}
on (rollOver) {
_global.playSound("sndButton");
}
Symbol 788 MovieClip Frame 1
stop();
Symbol 788 MovieClip Frame 2
stop();
Symbol 788 MovieClip Frame 3
stop();
Symbol 788 MovieClip Frame 4
stop();
Symbol 789 Button
on (press) {
onMainMenu_LevelStats();
}
on (rollOver) {
_global.playSound("sndButton");
}