home *** CD-ROM | disk | FTP | other *** search
- class PlayerOrientationHandler
- {
- var currentAngleDEG;
- var currentOrient;
- var currentFrame;
- var currentFlashAngle;
- var oldAngleDEG;
- var oldOrient;
- var oldFrame;
- var oldFlashAngle;
- var orientAngle;
- function PlayerOrientationHandler()
- {
- this.currentAngleDEG = 0;
- this.currentOrient = "Not Yet Invoked";
- this.currentFrame = -1;
- this.currentFlashAngle = -1;
- this.oldAngleDEG = this.currentAngleDEG;
- this.oldOrient = this.currentOrient;
- this.oldFrame = this.currentFrame;
- this.oldFlashAngle = this.currentFlashAngle;
- this.orientAngle = new Object();
- this.orientAngle.N = -90;
- this.orientAngle.E = 0;
- this.orientAngle.S = 90;
- this.orientAngle.WS = 180;
- this.orientAngle.WN = -180;
- }
- function getPlayerOrientation(angleDEG, type)
- {
- var _loc5_ = 15;
- var _loc2_ = new Object();
- _loc2_.orient = "Error";
- _loc2_.frame = -1;
- _loc2_.flash = -1;
- if(angleDEG >= this.orientAngle.N - _loc5_ && angleDEG <= this.orientAngle.N + _loc5_)
- {
- _loc2_.orient = "N";
- _loc2_.flash = -90;
- if(type == "mobile")
- {
- _loc2_.frame = 33;
- }
- if(type == "static")
- {
- _loc2_.frame = 69;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 97;
- }
- }
- if(angleDEG >= this.orientAngle.E - _loc5_ && angleDEG <= this.orientAngle.E + _loc5_)
- {
- _loc2_.orient = "E";
- _loc2_.flash = 0;
- if(type == "mobile")
- {
- _loc2_.frame = 49;
- }
- if(type == "static")
- {
- _loc2_.frame = 71;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 109;
- }
- }
- if(angleDEG >= this.orientAngle.S - _loc5_ && angleDEG <= this.orientAngle.S + _loc5_)
- {
- _loc2_.orient = "S";
- _loc2_.flash = 90;
- if(type == "mobile")
- {
- _loc2_.frame = 1;
- }
- if(type == "static")
- {
- _loc2_.frame = 65;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 73;
- }
- }
- if(angleDEG >= this.orientAngle.WS - _loc5_ && angleDEG <= this.orientAngle.WS || angleDEG >= this.orientAngle.WN && angleDEG <= this.orientAngle.WN + _loc5_)
- {
- _loc2_.orient = "W";
- _loc2_.flash = 180;
- if(type == "mobile")
- {
- _loc2_.frame = 17;
- }
- if(type == "static")
- {
- _loc2_.frame = 67;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 85;
- }
- }
- if(angleDEG > this.orientAngle.E + _loc5_ && angleDEG < this.orientAngle.S - _loc5_)
- {
- _loc2_.orient = "SE";
- _loc2_.flash = 45;
- if(type == "mobile")
- {
- _loc2_.frame = 57;
- }
- if(type == "static")
- {
- _loc2_.frame = 72;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 115;
- }
- }
- if(angleDEG > this.orientAngle.S + _loc5_ && angleDEG < this.orientAngle.WS - _loc5_)
- {
- _loc2_.orient = "SW";
- _loc2_.flash = 135;
- if(type == "mobile")
- {
- _loc2_.frame = 9;
- }
- if(type == "static")
- {
- _loc2_.frame = 66;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 79;
- }
- }
- if(angleDEG > this.orientAngle.WN + _loc5_ && angleDEG < this.orientAngle.N - _loc5_)
- {
- _loc2_.orient = "NW";
- _loc2_.flash = -135;
- if(type == "mobile")
- {
- _loc2_.frame = 25;
- }
- if(type == "static")
- {
- _loc2_.frame = 68;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 91;
- }
- }
- if(angleDEG < this.orientAngle.E - _loc5_ && angleDEG > this.orientAngle.N + _loc5_)
- {
- _loc2_.orient = "NE";
- _loc2_.flash = -45;
- if(type == "mobile")
- {
- _loc2_.frame = 41;
- }
- if(type == "static")
- {
- _loc2_.frame = 70;
- }
- if(type == "tacle")
- {
- _loc2_.frame = 103;
- }
- }
- this.oldAngleDEG = this.currentAngleDEG;
- this.oldOrient = this.currentOrient;
- this.oldFrame = this.currentFrame;
- this.oldFlashAngle = this.currentFlashAngle;
- this.currentAngleDEG = angleDEG;
- this.currentOrient = _loc2_.orient;
- this.currentFrame = _loc2_.frame;
- this.currentFlashAngle = _loc2_.flash;
- return _loc2_;
- }
- function getOldAngleDEG()
- {
- return this.oldAngleDEG;
- }
- function getOldOrient()
- {
- return this.oldOrient;
- }
- function getOldFrame()
- {
- return this.oldFrame;
- }
- function isFrameChanged()
- {
- return this.oldFrame != this.currentFrame;
- }
- function trace()
- {
- trace("PlayerOrientationHandler(orient,frame,angleDEG) = (" + this.currentOrient + "," + this.currentFrame + "," + this.currentAngleDEG + ")");
- }
- }
-