home *** CD-ROM | disk | FTP | other *** search
- function BuyCar(playcar, buycar)
- {
- var _loc1_ = playcar;
- var _loc3_ = buycar;
- _loc1_.NAME = _loc3_.NAME;
- _loc1_.HP = _root[_loc3_.NAME].HP;
- _loc1_.TQ = _root[_loc3_.NAME].TQ;
- _loc1_.CL = _root[_loc3_.NAME].CL;
- _loc1_.WT = _root[_loc3_.NAME].WT;
- _loc1_.FR = _root[_loc3_.NAME].FR;
- _loc1_.carworth = _root[_loc3_.NAME].carworth;
- _loc1_._frame = _loc3_._frame;
- _loc1_._base = "BASE";
- _loc1_.rimnum = 0;
- _loc1_._wheels = "WHEEL_1";
- _loc1_.wingnum = 0;
- _loc1_._wing = 1;
- _loc1_._fkit = "BLANK";
- _loc1_._skit = "BLANK";
- _loc1_._bkit = "BLANK";
- _loc1_._light = _loc3_._light;
- _loc1_.cols = {rb:0,bb:0,gb:0};
- _loc1_.rimcols = {rb:0,bb:0,gb:0};
- _loc1_.rimcols.rb = -100;
- _loc1_.rimcols.bb = -100;
- _loc1_.rimcols.gb = -100;
- _loc1_.kscols = {rb:0,bb:0,gb:0};
- _loc1_.calcols = {rb:-100,bb:-100,gb:-100};
- _loc1_.neoncols = {rb:-215,bb:-215,gb:-215};
- _loc1_.wintint = 0;
- _loc1_.wheelsize = 10;
- _loc1_.rideheight = 0;
- _loc1_.kitnum = 0;
- _loc1_.lightnum = 0;
- _loc1_.paintnum = 1;
- _loc1_.NOS = 1;
- _loc1_._exhaust = "MUFFLER_2";
- _loc1_.frameangle = 0;
- _loc1_.decalnum = 1;
- _loc1_.intnum = 1;
- _loc1_.hoodnum = 1;
- _loc1_.gearRatio = new Array();
- var _loc2_ = 1;
- while(_loc2_ <= GEAR_NUM)
- {
- _loc1_.gearRatio[_loc2_] = 1;
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- while(_loc2_ < UPGRADE_NUM)
- {
- _loc1_["UPGRADE" add _loc2_] = false;
- _loc2_ = _loc2_ + 1;
- }
- calFriction();
- }
- function newGame()
- {
- player = new Object();
- player.level = 1;
- car = new Object();
- car1 = new Object();
- car2 = new Object();
- car3 = new Object();
- }
- function gotoCarBuy()
- {
- gotoAndStop("carshop");
- play();
- }
- function WS_UPDATEHUD()
- {
- var _loc1_ = _root;
- STATS = _loc1_.car;
- carname = STATS.NAME;
- nickname = STATS.NICK;
- framename = STATS._frame;
- basename = STATS._base;
- kitname = STATS._fkit;
- wingname = STATS._wing;
- lightname = STATS._light;
- lwheelname = STATS._wheels;
- rg = STATS.cols.rb + 255;
- gg = STATS.cols.gb + 255;
- bg = STATS.cols.bb + 255;
- RIMS_r = STATS.rimcols.rb + 255;
- RIMS_g = STATS.rimcols.gb + 255;
- RIMS_b = STATS.rimcols.bb + 255;
- KS_r = STATS.kscols.rb + 255;
- KS_g = STATS.kscols.gb + 255;
- KS_b = STATS.kscols.bb + 255;
- SPO_r = STATS.spocols.rb + 255;
- SPO_g = STATS.spocols.gb + 255;
- SPO_b = STATS.spocols.bb + 255;
- NEON_r = STATS.neoncols.rb + 255;
- NEON_g = STATS.neoncols.gb + 255;
- NEON_b = STATS.neoncols.bb + 255;
- calr = STATS.calcols.rb + 255;
- calg = STATS.calcols.gb + 255;
- calb = STATS.calcols.bb + 255;
- RIMNUMBR = STATS.rimnum;
- WINGNUMBR = STATS.wingnum;
- LIGHTNUMBR = STATS.lightnum;
- KITNUMBR = STATS.kitnum;
- PAINTNUMBR = STATS.paintnum;
- rideh = _loc1_.car.rideheight;
- wheels = _loc1_.car.wheelsize;
- }
- function SetProperties(object, cn, nn, fn, bn, kn, wn, ln, rn, rh, ws, pn)
- {
- var _loc1_ = object;
- _loc1_.NAME = cn;
- _loc1_.NICK = nn;
- _loc1_.rideheight = rh;
- _loc1_.wheelsize = ws;
- _loc1_.paintnum = pn;
- }
- function SetColour(object, rr, gr, br, rimsr, rimsg, rimsb, ksr, ksg, ksb, spor, spog, spob, nr, ng, nb, calr, calb, calg)
- {
- var _loc1_ = object;
- _loc1_.cols = {rb:rr - 255,gb:gr - 255,bb:br - 255};
- _loc1_.rimcols = {rb:rimsr - 255,gb:rimsg - 255,bb:rimsb - 255};
- _loc1_.kscols = {rb:ksr - 255,gb:ksg - 255,bb:ksb - 255};
- _loc1_.spocols = {rb:spor - 255,gb:spog - 255,bb:spob - 255};
- _loc1_.neoncols = {rb:nr - 255,gb:ng - 255,bb:nb - 255};
- _loc1_.calcols = {rb:calr - 255,gb:calg - 255,bb:calb - 255};
- }
- function BuildCar(BUILD, x, y, name)
- {
- var _loc1_ = name;
- var _loc2_ = _root;
- var _loc3_ = BUILD;
- _loc2_[_loc1_].attachMovie(_loc3_._exhaust,"_exhaust",25);
- _loc2_[_loc1_].attachMovie(_loc3_._frame,"_frame",50);
- _loc2_[_loc1_].attachMovie("BASE","_base",20);
- _loc2_[_loc1_].attachMovie(_loc3_._wheels,"_lwheel",30);
- _loc2_[_loc1_].attachMovie(_loc3_._wheels,"_rwheel",40);
- _loc2_[_loc1_].attachMovie("CALIPER","_lcaliper",29);
- _loc2_[_loc1_].attachMovie("CALIPER","_rcaliper",39);
- _loc2_[_loc1_].attachMovie(_loc3_._fkit,"_fkit",70);
- _loc2_[_loc1_].attachMovie(_loc3_._skit,"_skit",80);
- _loc2_[_loc1_].attachMovie(_loc3_._bkit,"_bkit",90);
- if(_loc2_[_loc1_]._frame.SPOILER != undefined || Number(_loc3_._wing) != Math.NaN)
- {
- _loc2_[_loc1_]._frame.SPOILER.gotoAndStop(_loc3_._wing);
- }
- else
- {
- _loc2_[_loc1_]._frame.SPOILER.gotoAndStop(1);
- }
- _loc2_[_loc1_].attachMovie(_loc3_._light,"_light",60);
- _loc2_[_loc1_].attachMovie("NEON","_neon",10);
- _loc2_[_loc1_]._exhaust._x = _loc2_[_loc1_]._frame.XX._x;
- _loc2_[_loc1_]._exhaust._y = _loc2_[_loc1_]._frame.XX._y - _loc3_.rideheight;
- _loc2_[_loc1_]._lwheel._x = _loc2_[_loc1_]._frame.LWX._x;
- _loc2_[_loc1_]._lwheel._y = _loc2_[_loc1_]._frame.LWX._y;
- _loc2_[_loc1_]._rwheel._x = _loc2_[_loc1_]._frame.RWX._x;
- _loc2_[_loc1_]._rwheel._y = _loc2_[_loc1_]._frame.RWX._y;
- _loc2_[_loc1_]._lsus._x = _loc2_[_loc1_]._frame.LWX._x;
- _loc2_[_loc1_]._lsus._y = _loc2_[_loc1_]._frame.LWX._y;
- _loc2_[_loc1_]._rsus._x = _loc2_[_loc1_]._frame.RWX._x;
- _loc2_[_loc1_]._rsus._y = _loc2_[_loc1_]._frame.RWX._y;
- _loc2_[_loc1_]._lcaliper._x = _loc2_[_loc1_]._frame.LWX._x;
- _loc2_[_loc1_]._lcaliper._y = _loc2_[_loc1_]._frame.LWX._y;
- _loc2_[_loc1_]._rcaliper._x = _loc2_[_loc1_]._frame.RWX._x;
- _loc2_[_loc1_]._rcaliper._y = _loc2_[_loc1_]._frame.RWX._y;
- _loc2_[_loc1_]._rwheel._width += _loc3_.wheelsize;
- _loc2_[_loc1_]._rwheel._height += _loc3_.wheelsize;
- _loc2_[_loc1_]._lwheel._width += _loc3_.wheelsize;
- _loc2_[_loc1_]._lwheel._height += _loc3_.wheelsize;
- _loc2_[_loc1_]._wing._x = _loc2_[_loc1_]._frame.SP._x;
- _loc2_[_loc1_]._wing._y = _loc2_[_loc1_]._frame.SP._y;
- _loc2_[_loc1_]._x = x;
- _loc2_[_loc1_]._y = y;
- _loc2_[_loc1_]._frame._alpha = 100 + _loc3_.wintint;
- _loc2_[_loc1_]._frame._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._light._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._fkit._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._skit._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._bkit._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._wing._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._base._y -= _loc3_.rideheight;
- _loc2_[_loc1_]._neon._width = _loc2_[_loc1_]._frame._width + 30;
- _loc2_[_loc1_]._neon._x = 0;
- _loc2_[_loc1_]._neon._y = _loc2_[_loc1_]._lwheel._y + _loc2_[_loc1_]._lwheel._height / 2 - 15;
- _loc2_[_loc1_]._frame.gotoAndStop(_loc3_.paintnum);
- _loc2_[_loc1_]._frame.DECAL.gotoAndStop(_loc3_.decalnum);
- _loc2_[_loc1_]._frame.BONNET.gotoAndStop(_loc3_.hoodnum);
- setcol = new Color(_loc2_[_loc1_]._frame);
- setcol.setTransform(_loc3_.cols);
- setcol = new Color(_loc2_[_loc1_]._frame.DECAL);
- setcol.setTransform({rb:- _loc3_.cols.rb,bb:- _loc3_.cols.bb,gb:- _loc3_.cols.gb});
- if(_loc3_.hoodnum > 1)
- {
- setcol = new Color(_loc2_[_loc1_]._frame.BONNET);
- setcol.setTransform({rb:- _loc3_.cols.rb,bb:- _loc3_.cols.bb,gb:- _loc3_.cols.gb});
- }
- if(_loc3_.hoodnum == undefined)
- {
- _loc2_[_loc1_]._frame.BONNET.gotoAndStop(1);
- }
- if(_loc3_._wing == 6 || _loc3_._wing == 13)
- {
- setcol = new Color(_loc2_[_loc1_]._frame.SPOILER);
- setcol.setTransform({rb:- _loc3_.cols.rb,bb:- _loc3_.cols.bb,gb:- _loc3_.cols.gb});
- }
- setcol = new Color(_loc2_[_loc1_]._frame.INTERIOR);
- setcol.setTransform({rb:- _loc3_.cols.rb,bb:- _loc3_.cols.bb,gb:- _loc3_.cols.gb});
- setcol = new Color(_loc2_[_loc1_]._lcaliper);
- setcol.setTransform(_loc3_.calcols);
- setcol = new Color(_loc2_[_loc1_]._rcaliper);
- setcol.setTransform(_loc3_.calcols);
- setcol = new Color(_loc2_[_loc1_]._lwheel);
- setcol.setTransform(_loc3_.rimcols);
- setcol = new Color(_loc2_[_loc1_]._rwheel);
- setcol.setTransform(_loc3_.rimcols);
- setcol = new Color(_loc2_[_loc1_]._fkit);
- setcol.setTransform(_loc3_.kscols);
- setcol = new Color(_loc2_[_loc1_]._skit);
- setcol.setTransform(_loc3_.kscols);
- setcol = new Color(_loc2_[_loc1_]._bkit);
- setcol.setTransform(_loc3_.kscols);
- setcol = new Color(_loc2_[_loc1_]._neon);
- setcol.setTransform(_loc3_.neoncols);
- _loc2_[_loc1_]._frame.INTERIOR.gotoAndStop(_loc3_.intnum);
- _loc2_[_loc1_]._rotation = _loc3_.frameangle;
- _loc2_[_loc1_]._neon._rotation = - _loc3_.frameangle;
- _loc2_[_loc1_]._lwheel._y = (- Math.sin(_loc2_[_loc1_]._rotation * 3.141592653589793 / 180)) * _loc2_[_loc1_]._frame.LWX._x + _loc2_[_loc1_]._frame.LWX._y;
- _loc2_[_loc1_]._rwheel._y = (- Math.sin(_loc2_[_loc1_]._rotation * 3.141592653589793 / 180)) * _loc2_[_loc1_]._frame.RWX._x + _loc2_[_loc1_]._frame.RWX._y;
- _loc2_[_loc1_]._lcaliper._y = (- Math.sin(_loc2_[_loc1_]._rotation * 3.141592653589793 / 180)) * _loc2_[_loc1_]._frame.LWX._x + _loc2_[_loc1_]._frame.LWX._y;
- _loc2_[_loc1_]._rcaliper._y = (- Math.sin(_loc2_[_loc1_]._rotation * 3.141592653589793 / 180)) * _loc2_[_loc1_]._frame.RWX._x + _loc2_[_loc1_]._frame.RWX._y;
- }
- function WindowTint(b, a)
- {
- var _loc1_ = b;
- _loc1_.wintint += a;
- if(_loc1_.wintint > 150)
- {
- _loc1_.wintint = 150;
- }
- else if(_loc1_.wintint < 0)
- {
- _loc1_.wintint = 0;
- }
- }
- function toHex(j)
- {
- c1 = Math.floor(j / 16);
- r = j - c1 * 16;
- c2 = r;
- if(c1 >= 10)
- {
- if(c1 == 10)
- {
- c1 = "A";
- }
- if(c1 == 11)
- {
- c1 = "B";
- }
- if(c1 == 12)
- {
- c1 = "C";
- }
- if(c1 == 13)
- {
- c1 = "D";
- }
- if(c1 == 14)
- {
- c1 = "E";
- }
- if(c1 == 15)
- {
- c1 = "F";
- }
- }
- if(c2 >= 10)
- {
- if(c2 == 10)
- {
- c2 = "A";
- }
- if(c2 == 11)
- {
- c2 = "B";
- }
- if(c2 == 12)
- {
- c2 = "C";
- }
- if(c2 == 13)
- {
- c2 = "D";
- }
- if(c2 == 14)
- {
- c2 = "E";
- }
- if(c2 == 15)
- {
- c2 = "F";
- }
- }
- return c1 add c2;
- }
- function savegame(player, obj1, obj2)
- {
- var _loc2_ = obj1;
- var _loc1_ = new LoadVars();
- dir = appdir add "\\SAVE\\" add player add ".drs";
- dircont = "";
- _loc1_.PC = _loc2_.cash;
- _loc1_.PN = _loc2_.name;
- _loc1_.LVL = _loc2_.level;
- SaveGarage(_loc1_,"");
- SaveGarage(_loc1_,1);
- SaveGarage(_loc1_,2);
- SaveGarage(_loc1_,3);
- dircont = ENCODE(_loc1_.toString() add "&",1);
- fscommand("flashstudio.savetofile","dir,dircont");
- }
- function ENCODE(str, offset)
- {
- var _loc2_ = str;
- var _loc3_ = "";
- var _loc1_ = 0;
- while(_loc1_ < _loc2_.length)
- {
- _loc3_ += chr(ord(_loc2_.charAt(_loc1_)) + offset);
- _loc1_ = _loc1_ + 1;
- }
- return _loc3_;
- }
- function DECODE(str, offset)
- {
- return ENCODE(str,- offset);
- }
- function LoadVar(bigstr, str)
- {
- var _loc1_ = str;
- var _loc2_ = bigstr;
- index = _loc2_.indexOf(_loc1_ add "=") + _loc1_.length + 1;
- index2 = _loc2_.indexOf("&",index);
- subst = _loc2_.substring(index,index2);
- if(subst.indexOf("%5F") != -1)
- {
- if(subst.indexOf("%5F") == 0)
- {
- subst = "_" add subst.slice(3);
- }
- else
- {
- subst = subst.slice(0,subst.indexOf("%5F")) add "_" add subst.slice(subst.indexOf("%5F") + 3);
- }
- }
- if(subst.indexOf("%5F") != -1)
- {
- if(subst.indexOf("%5F") == 0)
- {
- subst = "_" add subst.slice(3);
- }
- else
- {
- subst = subst.slice(0,subst.indexOf("%5F")) add "_" add subst.slice(subst.indexOf("%5F") + 3);
- }
- }
- if(subst.indexOf("%2D") != -1)
- {
- subst = "-" add subst.slice(3);
- }
- if(subst.indexOf("%2E") != -1)
- {
- if(subst.indexOf("%2E") == 0)
- {
- subst = "." add subst.slice(3);
- }
- else
- {
- subst = subst.slice(0,subst.indexOf("%2E")) add "." add subst.slice(subst.indexOf("%2E") + 3);
- }
- }
- if(subst == undefined)
- {
- return "...";
- }
- return subst;
- }
- function LoadGame(bigstr)
- {
- var _loc1_ = DECODE(bigstr,1);
- player = new Object();
- player.name = LOADNAME;
- car = new Object();
- player.cash = Number(LoadVar(_loc1_,"PC"));
- if(isNaN(player.cash))
- {
- return false;
- }
- player.name = LoadVar(_loc1_,"PN");
- player.level = Number(LoadVar(_loc1_,"LVL"));
- if(player.level == Math.NaN)
- {
- player.level = 1;
- }
- LoadGarage(_loc1_,"");
- LoadGarage(_loc1_,1);
- LoadGarage(_loc1_,2);
- LoadGarage(_loc1_,3);
- return true;
- }
- function prompt(title, message, icon)
- {
- var _loc1_ = _root;
- _loc1_.attachMovie("WINDOW_PROMPT","promptwindow",1779);
- _loc1_.promptwindow.titletext = title;
- _loc1_.promptwindow.message = message;
- _loc1_.promptwindow.icon.gotoAndStop(icon);
- }
- function buyMenu(obj, buyingwhat)
- {
- var _loc1_ = _root;
- _loc1_.attachMovie("WINDOW_BUY","promptwindow",666);
- _loc1_.promptwindow.m_buyingwhat = buyingwhat;
- _loc1_.promptwindow.car = obj;
- }
- function buyItem(ccar, item, bought)
- {
- var _loc1_ = item;
- var _loc2_ = ccar;
- if(_loc1_.length < 4)
- {
- _loc2_[_loc1_] += bought;
- if(_loc2_[_loc1_] > _root[_loc1_ add "MAX"])
- {
- _loc2_[_loc1_] = _root[_loc1_ add "MAX"];
- }
- if(_loc1_ == "WT" && _loc2_[_loc1_] < WTMIN)
- {
- _loc2_[_loc1_] = WTMIN;
- }
- }
- else
- {
- _loc2_[_loc1_] = bought;
- }
- }
- function calFriction()
- {
- heightbon = Math.round(Math.abs(car.rideheight + 10) / 35 * 10);
- anglebon = Math.round(Math.abs(car.frameangle) / 3 * 5);
- car.FR = heightbon + anglebon;
- }
- function gotoRace()
- {
- gotoAndPlay(459);
- }
- function gotoStory()
- {
- gotoAndStop("STORY");
- play();
- }
- function loadFromFile(filenm)
- {
- FILENAME = filenm;
- CONTENT = new String();
- fscommand("flashstudio.loadfromfile","FILENAME,CONTENT");
- }
- UPGRADE_NUM = 34;
- GEAR_NUM = 6;
- RACEquality = "low";
- appdir = "C:\\";
- fscommand("flashstudio.appdir","appdir");
- CARS = new Array();
- CARS.push("BMWM5");
- CARS.push("ACCORD");
- CARS.push("CARRERAGT");
- CARS.push("CELICA");
- CARS.push("SX240");
- CARS.push("CHARGER");
- CARS.push("CIVIC");
- CARS.push("COMET");
- CARS.push("COOPER");
- CARS.push("CRX");
- CARS.push("ECLIPSE");
- CARS.push("FERRARI");
- CARS.push("FTO");
- CARS.push("G35");
- CARS.push("HUMMER");
- CARS.push("IMPREZA");
- CARS.push("INTEGRA");
- CARS.push("IS300");
- CARS.push("LANCER");
- CARS.push("M3");
- CARS.push("MCLAREN");
- CARS.push("MODENA");
- CARS.push("MR2");
- CARS.push("NECLIPSE");
- CARS.push("NSX");
- CARS.push("P911");
- CARS.push("PRELUDE");
- CARS.push("RSX");
- CARS.push("RX7");
- CARS.push("RX7GEN3");
- CARS.push("RX8");
- CARS.push("S4");
- CARS.push("S2000");
- CARS.push("SALEEN");
- CARS.push("SC430");
- CARS.push("SHELBY");
- CARS.push("SILVIA");
- CARS.push("SKYLINE");
- CARS.push("SKYLINER34");
- CARS.push("SUPRA");
- CARS.push("TIBURON");
- CARS.push("TT");
- CARS.push("VANQUISH");
- CARS.push("VIPER");
- CARS.push("VIPERSRT");
- CARS.push("P911GT1");
- CARS.push("ELISE");
- CARS.push("MURCIELAGO");
- CARS.push("GT40");
- CARS.push("PROTEGE");
- CARS.push("Z");
- CARS.push("Z4");
- CARS.push("Z8");
- CARS.push("GOLF");
- CARS.push("ZX300");
- CARS.push("SENTRA");
- CARS.push("BARACUDA");
- CARS.push("CORVETTEZ");
- CARS.push("STEALTH");
- CARS.push("ZX3002");
- CARS.push("CIVICH");
- CARS.push("MUSTANG");
- CARS.push("TIBURON2");
- RIMS = new Array();
- RIMS.push("WHEEL_1");
- RIMS.push("WHEEL_2");
- RIMS.push("WHEEL_3");
- RIMS.push("WHEEL_4");
- RIMS.push("WHEEL_5");
- RIMS.push("WHEEL_6");
- RIMS.push("WHEEL_7");
- RIMS.push("WHEEL_8");
- RIMS.push("WHEEL_9");
- RIMS.push("WHEEL_10");
- RIMS.push("WHEEL_11");
- RIMS.push("WHEEL_12");
- RIMS.push("WHEEL_13");
- RIMS.push("WHEEL_14");
- RIMS.push("WHEEL_15");
- RIMS.push("WHEEL_16");
- LIGHT = new Array();
- LIGHT.push("_1");
- LIGHT.push("_2");
- LIGHT.push("_3");
- LIGHT.push("_4");
- LIGHT.push("_5");
- LIGHT.push("_6");
- LIGHT.push("_7");
- WING = new Array();
- WING.push("BLANK");
- WING.push("WING_1");
- WING.push("WING_2");
- WING.push("WING_3");
- WING.push("WING_4");
- WING.push("WING_5");
- HPMAX = 1100;
- TQMAX = 800;
- CLMAX = 5;
- WTMAX = 2500;
- WTMIN = 1000;
- FRMAX = 15;
- NOSMAX = 100;
- RIMMAX = 21;
- SPOILERMAX = 14;
-