Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/data/CommandHandler.as b/data/CommandHandler.as
- index 0a6aa35..2bcc26f 100644
- --- a/data/CommandHandler.as
- +++ b/data/CommandHandler.as
- @@ -35,6 +35,7 @@
- this.defineCommand("setRank",this.setRank);
- this.defineCommand("setGroup",this.setGroup);
- this.defineCommand("startGame",this.startGame);
- + this.defineCommand("startReplay",this.startReplay);
- this.defineCommand("resend",this.resend);
- this.defineCommand("pmNotify",this.pmNotify);
- this.defineCommand("becomeSpecialUser",this.becomeSpecialUser);
- @@ -112,6 +113,13 @@
- Main.pageHolder.changePage(new Game(_loc2_,Main.filledSlotCourseVersion));
- }
- }
- +
- + private function startReplay(param1:Array):void
- + {
- + var course:String = param1[0];
- + var version:String = param1[1];
- + Main.pageHolder.changePage(new Game(course, version));
- + }
- private function setRank(param1:Array) : *
- {
- diff --git a/package_6/Game.as b/package_6/Game.as
- index 774cc52..89cfa00 100644
- --- a/package_6/Game.as
- +++ b/package_6/Game.as
- @@ -13,6 +13,7 @@
- import sounds.SoundEffects;
- import data.Settings;
- import flash.utils.*;
- + import package_8.Spectator;
- public class Game extends Course
- {
- @@ -51,6 +52,8 @@
- public var var_347:int;
- private var hatCountdown:uint;
- +
- + private var spectator:Spectator;
- public function Game(param1:int, param2:int)
- {
- @@ -79,6 +82,7 @@
- holder.addChild(this.quitButton);
- this.cm.defineCommand("createRemoteCharacter",this.createRemoteCharacter);
- this.cm.defineCommand("createLocalCharacter",this.createLocalCharacter);
- + this.cm.defineCommand("createSpectator",this.createSpectator);
- this.cm.defineCommand("award",this.award);
- this.cm.defineCommand("setExpGain",this.setExpGain);
- this.cm.defineCommand("setLuxGain",this.setLuxGain);
- @@ -250,6 +254,9 @@
- playerArray[_loc2_] = _loc16_;
- this.drawingInfo.method_138(_loc3_,_loc2_);
- method_80();
- + // spectate a character as soon as one is created
- + if (this.spectator != null && this.spectator.spectating == null)
- + this.spectator.spectating = _loc16_;
- }
- private function createLocalCharacter(param1:Array) : *
- @@ -277,6 +284,11 @@
- var_9 = _loc18_;
- method_80();
- }
- +
- + private function createSpectator(param1:Array):void
- + {
- + this.spectator = new Spectator(this);
- + }
- override public function collectEgg(param1:int) : *
- {
- @@ -421,8 +433,10 @@
- override public function remove() : *
- {
- + if (this.spectator != null) this.spectator.remove();
- this.cm.defineCommand("createRemoteCharacter",null);
- this.cm.defineCommand("createLocalCharacter",null);
- + this.cm.defineCommand("createSpectator",null);
- this.cm.defineCommand("award",null);
- this.cm.defineCommand("setExpGain",null);
- this.cm.defineCommand("setLuxGain",null);
- diff --git a/package_8/LocalCharacter.as b/package_8/LocalCharacter.as
- index d2e70df..f0bb557 100644
- --- a/package_8/LocalCharacter.as
- +++ b/package_8/LocalCharacter.as
- @@ -337,12 +337,17 @@
- }
- method_58(this.map.rotation);
- this.hurtTime--;
- - if(this.course.playerArray.length > 1)
- + // This prevents the client from sending packets to the server
- + // when there are no other players in the race. We need to still
- + // send packets to the VCR in the server. Maybe a flag somewhere
- + // in the options to enable/disable replays?
- + //if(this.course.playerArray.length > 1)
- {
- var_215++;
- if(var_215 >= var_448)
- {
- - if(this.method_779() || var_215 >= 23)
- + // This does much the same.
- + //if(this.method_779() || var_215 >= 23)
- {
- var_215 = 0;
- _loc5_ = _loc2_ - this.var_443;
- diff --git a/package_8/Spectator.as b/package_8/Spectator.as
- new file mode 100644
- index 0000000..3bf6af4
- --- /dev/null
- +++ b/package_8/Spectator.as
- @@ -0,0 +1,58 @@
- +package package_8
- +{
- + import flash.events.Event;
- + import package_6.Course;
- + import data.CommandHandler;
- + import flash.ui.Keyboard;
- +
- + public class Spectator extends Character
- + {
- + public var spectating:RemoteCharacter;
- + private var course:Course;
- + private var cm:CommandHandler;
- +
- + public function Spectator(course:Course)
- + {
- + super();
- + this.addEventListener(Event.ENTER_FRAME, this.go, false, 0, true);
- + this.course = course;
- + this.course.frontBackground.addChild(this);
- + }
- +
- + private function createRemoteCharacter(args:Array):void
- + {
- + var id:int = args[0];
- + if (this.spectating == null)
- + this.spectate(course.playerArray[id]);
- + }
- +
- + public function go(e:Event):void
- + {
- + if (Keys.isPressed(Keyboard.NUMBER_1) && course.playerArray[0] != null)
- + this.spectating = course.playerArray[0];
- + else if (Keys.isPressed(Keyboard.NUMBER_2) && course.playerArray[1] != null)
- + this.spectating = course.playerArray[1];
- + else if (Keys.isPressed(Keyboard.NUMBER_3) && course.playerArray[2] != null)
- + this.spectating = course.playerArray[2];
- + else if (Keys.isPressed(Keyboard.NUMBER_4) && course.playerArray[3] != null)
- + this.spectating = course.playerArray[3];
- +
- + if (this.spectating != null)
- + this.setPos(this.spectating.x, this.spectating.y);
- + }
- +
- + override public function setPos(x:Number, y:Number):*
- + {
- + this.course.posX = -x;
- + this.course.posY = -y;
- + this.course.setPos(-x,-y);
- + }
- +
- + override public function remove():*
- + {
- + this.course.frontBackground.removeChild(this);
- + this.removeEventListener(Event.ENTER_FRAME, this.go);
- + super.remove();
- + }
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement