Advertisement
Guest User

Untitled

a guest
Aug 28th, 2020
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.96 KB | None | 0 0
  1. diff --git a/data/CommandHandler.as b/data/CommandHandler.as
  2. index 0a6aa35..2bcc26f 100644
  3. --- a/data/CommandHandler.as
  4. +++ b/data/CommandHandler.as
  5. @@ -35,6 +35,7 @@
  6.           this.defineCommand("setRank",this.setRank);
  7.           this.defineCommand("setGroup",this.setGroup);
  8.           this.defineCommand("startGame",this.startGame);
  9. +        this.defineCommand("startReplay",this.startReplay);
  10.           this.defineCommand("resend",this.resend);
  11.           this.defineCommand("pmNotify",this.pmNotify);
  12.           this.defineCommand("becomeSpecialUser",this.becomeSpecialUser);
  13. @@ -112,6 +113,13 @@
  14.              Main.pageHolder.changePage(new Game(_loc2_,Main.filledSlotCourseVersion));
  15.           }
  16.        }
  17. +    
  18. +     private function startReplay(param1:Array):void
  19. +     {
  20. +         var course:String = param1[0];
  21. +         var version:String = param1[1];
  22. +         Main.pageHolder.changePage(new Game(course, version));
  23. +     }
  24.        
  25.        private function setRank(param1:Array) : *
  26.        {
  27. diff --git a/package_6/Game.as b/package_6/Game.as
  28. index 774cc52..89cfa00 100644
  29. --- a/package_6/Game.as
  30. +++ b/package_6/Game.as
  31. @@ -13,6 +13,7 @@
  32.     import sounds.SoundEffects;
  33.     import data.Settings;
  34.     import flash.utils.*;
  35. +   import package_8.Spectator;
  36.    
  37.     public class Game extends Course
  38.     {
  39. @@ -51,6 +52,8 @@
  40.        public var var_347:int;
  41.        
  42.        private var hatCountdown:uint;
  43. +    
  44. +     private var spectator:Spectator;
  45.        
  46.        public function Game(param1:int, param2:int)
  47.        {
  48. @@ -79,6 +82,7 @@
  49.           holder.addChild(this.quitButton);
  50.           this.cm.defineCommand("createRemoteCharacter",this.createRemoteCharacter);
  51.           this.cm.defineCommand("createLocalCharacter",this.createLocalCharacter);
  52. +        this.cm.defineCommand("createSpectator",this.createSpectator);
  53.           this.cm.defineCommand("award",this.award);
  54.           this.cm.defineCommand("setExpGain",this.setExpGain);
  55.           this.cm.defineCommand("setLuxGain",this.setLuxGain);
  56. @@ -250,6 +254,9 @@
  57.           playerArray[_loc2_] = _loc16_;
  58.           this.drawingInfo.method_138(_loc3_,_loc2_);
  59.           method_80();
  60. +        // spectate a character as soon as one is created
  61. +        if (this.spectator != null && this.spectator.spectating == null)
  62. +           this.spectator.spectating = _loc16_;
  63.        }
  64.        
  65.        private function createLocalCharacter(param1:Array) : *
  66. @@ -277,6 +284,11 @@
  67.           var_9 = _loc18_;
  68.           method_80();
  69.        }
  70. +    
  71. +     private function createSpectator(param1:Array):void
  72. +     {
  73. +        this.spectator = new Spectator(this);
  74. +     }
  75.        
  76.        override public function collectEgg(param1:int) : *
  77.        {
  78. @@ -421,8 +433,10 @@
  79.        
  80.        override public function remove() : *
  81.        {
  82. +         if (this.spectator != null) this.spectator.remove();
  83.           this.cm.defineCommand("createRemoteCharacter",null);
  84.           this.cm.defineCommand("createLocalCharacter",null);
  85. +        this.cm.defineCommand("createSpectator",null);
  86.           this.cm.defineCommand("award",null);
  87.           this.cm.defineCommand("setExpGain",null);
  88.           this.cm.defineCommand("setLuxGain",null);
  89. diff --git a/package_8/LocalCharacter.as b/package_8/LocalCharacter.as
  90. index d2e70df..f0bb557 100644
  91. --- a/package_8/LocalCharacter.as
  92. +++ b/package_8/LocalCharacter.as
  93. @@ -337,12 +337,17 @@
  94.           }
  95.           method_58(this.map.rotation);
  96.           this.hurtTime--;
  97. -         if(this.course.playerArray.length > 1)
  98. +        // This prevents the client from sending packets to the server
  99. +        // when there are no other players in the race. We need to still
  100. +        // send packets to the VCR in the server. Maybe a flag somewhere
  101. +        // in the options to enable/disable replays?
  102. +         //if(this.course.playerArray.length > 1)
  103.           {
  104.              var_215++;
  105.              if(var_215 >= var_448)
  106.              {
  107. -               if(this.method_779() || var_215 >= 23)
  108. +               // This does much the same.
  109. +               //if(this.method_779() || var_215 >= 23)
  110.                 {
  111.                    var_215 = 0;
  112.                    _loc5_ = _loc2_ - this.var_443;
  113. diff --git a/package_8/Spectator.as b/package_8/Spectator.as
  114. new file mode 100644
  115. index 0000000..3bf6af4
  116. --- /dev/null
  117. +++ b/package_8/Spectator.as
  118. @@ -0,0 +1,58 @@
  119. +package package_8
  120. +{
  121. +   import flash.events.Event;
  122. +   import package_6.Course;
  123. +   import data.CommandHandler;
  124. +   import flash.ui.Keyboard;
  125. +  
  126. +   public class Spectator extends Character
  127. +   {
  128. +       public var spectating:RemoteCharacter;
  129. +       private var course:Course;
  130. +       private var cm:CommandHandler;
  131. +      
  132. +       public function Spectator(course:Course)
  133. +       {
  134. +           super();
  135. +           this.addEventListener(Event.ENTER_FRAME, this.go, false, 0, true);
  136. +           this.course = course;
  137. +           this.course.frontBackground.addChild(this);
  138. +       }
  139. +      
  140. +       private function createRemoteCharacter(args:Array):void
  141. +       {
  142. +           var id:int = args[0];
  143. +           if (this.spectating == null)
  144. +               this.spectate(course.playerArray[id]);
  145. +       }
  146. +      
  147. +       public function go(e:Event):void
  148. +       {
  149. +           if (Keys.isPressed(Keyboard.NUMBER_1) && course.playerArray[0] != null)
  150. +               this.spectating = course.playerArray[0];
  151. +           else if (Keys.isPressed(Keyboard.NUMBER_2) && course.playerArray[1] != null)
  152. +               this.spectating = course.playerArray[1];
  153. +           else if (Keys.isPressed(Keyboard.NUMBER_3) && course.playerArray[2] != null)
  154. +               this.spectating = course.playerArray[2];
  155. +           else if (Keys.isPressed(Keyboard.NUMBER_4) && course.playerArray[3] != null)
  156. +               this.spectating = course.playerArray[3];
  157. +          
  158. +           if (this.spectating != null)
  159. +               this.setPos(this.spectating.x, this.spectating.y);
  160. +       }
  161. +      
  162. +       override public function setPos(x:Number, y:Number):*
  163. +       {
  164. +           this.course.posX = -x;
  165. +           this.course.posY = -y;
  166. +           this.course.setPos(-x,-y);
  167. +       }
  168. +      
  169. +       override public function remove():*
  170. +       {
  171. +           this.course.frontBackground.removeChild(this);
  172. +           this.removeEventListener(Event.ENTER_FRAME, this.go);
  173. +           super.remove();
  174. +       }
  175. +   }
  176. +}
  177. \ No newline at end of file
  178.  
  179.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement