home *** CD-ROM | disk | FTP | other *** search
- t = GAME;
- t.parameters.focalLength = 175;
- t.parameters.viewAngle = 155;
- t.yOrigin = 0;
- t.y3DAdjust = Math.cos(t.parameters.viewAngle / 57.29577951308232);
- t.z3DAdjust = Math.sin(t.parameters.viewAngle / 57.29577951308232);
- t.init3D = function()
- {
- this.createGameToScreenTableY();
- this.createScreenToGameTableY();
- this.mapGameToScreen = function(game_x, game_y)
- {
- var _loc2_ = this.gameToScreenTableY[Math.floor(game_y)];
- _loc2_._x = game_x;
- return _loc2_;
- };
- };
- t.mapGameTo3D = function(game_x, game_y)
- {
- var _loc2_ = game_x;
- var _loc3_ = game_y * this.y3DAdjust;
- var _loc4_ = game_y * this.z3DAdjust;
- return {x3D:_loc2_,y3D:_loc3_,z3D:_loc4_};
- };
- t.map3DToScreen = function(x3D, y3D, z3D)
- {
- var _loc2_ = GAME.parameters.focalLength / (z3D + GAME.parameters.focalLength);
- var _loc4_ = x3D;
- var _loc5_ = this.yOrigin + y3D * _loc2_;
- var _loc3_ = _loc2_ * 100;
- return {_x:_loc4_,_y:_loc5_,_xscale:_loc3_,_yscale:_loc3_,zRatio:_loc2_};
- };
- t.mapGameToScreen = function(game_x, game_y)
- {
- var _loc2_ = this.mapGameTo3D(game_x,game_y);
- return this.map3DToScreen(_loc2_.x3D,_loc2_.y3D,_loc2_.z3D);
- };
- t.mapScreenToGame = function(screenX, screenY)
- {
- return {game_x:screenX,game_y:this.screenToGameTableY[Math.floor(screenY)]};
- };
- t.drawOnScreen = function(obj, applyScale)
- {
- var _loc5_ = this.mapGameTo3D(obj.game_x,obj.game_y);
- var _loc4_ = this.map3DToScreen(_loc5_.x3D,_loc5_.y3D,_loc5_.z3D);
- obj.mc._x = _loc4_._x;
- obj.mc._y = _loc4_._y;
- if(applyScale)
- {
- obj.mc._xscale = _loc4_._xscale;
- obj.mc._yscale = _loc4_._yscale;
- }
- var _loc6_ = obj.mc._y;
- if(obj.mc.depth_marker != undefined)
- {
- _loc6_ += obj.mc.depth_marker._y * (obj.mc._xscale / 100);
- }
- var _loc2_ = Math.floor(_loc6_ * 100);
- while(GAME.mc.getInstanceAtDepth(_loc2_) != undefined)
- {
- _loc2_ = _loc2_ + 1;
- }
- obj.mc.swapDepths(_loc2_);
- };
- t.createGameToScreenTableY = function()
- {
- var _loc2_ = 0;
- while(_loc2_ < 1200)
- {
- this.gameToScreenTableY[_loc2_] = this.mapGameToScreen(0,_loc2_);
- _loc2_ = _loc2_ + 1;
- }
- };
- t.createScreenToGameTableY = function()
- {
- var _loc2_ = 0;
- while(_loc2_ < this.gameToScreenTableY.length)
- {
- var _loc3_ = this.gameToScreenTableY[_loc2_];
- var _loc4_ = Math.floor(_loc3_._y);
- this.screenToGameTableY[_loc4_] = _loc2_;
- _loc2_ = _loc2_ + 1;
- }
- };
- t.gameToScreenTableY = new Array();
- t.screenToGameTableY = new Array();
-