home *** CD-ROM | disk | FTP | other *** search
/ MACD 7 / MACD7.iso / www / weirdscience / classes / bullets.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-14  |  11.6 KB  |  661 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Event;
  6. import java.awt.Graphics;
  7. import java.awt.Image;
  8. import java.util.StringTokenizer;
  9.  
  10. public class Bullets extends Applet implements Runnable {
  11.    private static final int NONE = 0;
  12.    private static final int LEFT = 1;
  13.    private static final int RIGHT = 2;
  14.    // $FF: renamed from: UP int
  15.    private static final int field_0 = 3;
  16.    private static final int DOWN = 4;
  17.    // $FF: renamed from: IN int
  18.    private static final int field_1 = 5;
  19.    private static final int OUT = 6;
  20.    private static final int CYCLE = 0;
  21.    private static final int FADE = 1;
  22.    private static Bullets threadMaster;
  23.    private static Bullets[] uniqueAppList;
  24.    private long nextUpdateTime;
  25.    private Thread mainThread;
  26.    // $FF: renamed from: R int
  27.    private int field_2;
  28.    // $FF: renamed from: G int
  29.    private int field_3;
  30.    // $FF: renamed from: B int
  31.    private int field_4;
  32.    private int ToR;
  33.    private int ToG;
  34.    private int ToB;
  35.    private int fadeCounter;
  36.    private int fadeAmount = 15;
  37.    private int[] colors;
  38.    private int colorIndex;
  39.    private int displayCounter;
  40.    private int displayColors = 1;
  41.    private int delay;
  42.    private int pauseTime;
  43.    private int smoothness = 5;
  44.    private int effect = 1;
  45.    private int direction;
  46.    private Color currentColor;
  47.    private Color bgColor;
  48.    private Color[] displayList;
  49.    public volatile Graphics offGraphic;
  50.    private Image offImage;
  51.    public volatile Bullets[] slaveList;
  52.    private volatile Bullets master;
  53.    private boolean isBullet = true;
  54.  
  55.    public boolean mouseDown(Event var1, int var2, int var3) {
  56.       System.out.println("uniqueAppList.length is " + uniqueAppList.length);
  57.  
  58.       for(int var4 = 0; var4 < uniqueAppList.length; ++var4) {
  59.          System.out.println("Master " + var4 + " slavelist.length is " + uniqueAppList[var4].slaveList.length);
  60.  
  61.          for(int var5 = 0; var5 < uniqueAppList[var4].slaveList.length; ++var5) {
  62.             System.out.println(uniqueAppList[var4].slaveList[var5].getGraphics());
  63.          }
  64.       }
  65.  
  66.       return true;
  67.    }
  68.  
  69.    public String getAppletInfo() {
  70.       return "Bullets 1.01 - Copyright Â© 1996, Macromedia, Inc.";
  71.    }
  72.  
  73.    private int convertTime(String var1, String var2, double var3) {
  74.       if (var2 == null) {
  75.          return (int)(var3 * (double)1000.0F);
  76.       } else {
  77.          double var5;
  78.          try {
  79.             var5 = Double.valueOf(var2) * (double)1000.0F;
  80.          } catch (NumberFormatException var7) {
  81.             System.out.println("Invalid value " + var2 + " for parameter '" + var1 + "', using " + var3);
  82.             var5 = var3 * (double)1000.0F;
  83.          }
  84.  
  85.          return (int)var5;
  86.       }
  87.    }
  88.  
  89.    public void init() {
  90.       int var2 = 0;
  91.       String var1 = ((Applet)this).getParameter("bgcolor");
  92.       this.bgColor = new Color(this.getColor(var1, ((Component)this).getBackground().getRGB()));
  93.       this.currentColor = this.bgColor;
  94.       var1 = ((Applet)this).getParameter("fps");
  95.       if (var1 != null) {
  96.          try {
  97.             var2 = Integer.parseInt(var1);
  98.          } catch (NumberFormatException var9) {
  99.          }
  100.       }
  101.  
  102.       this.delay = var2 > 0 ? 1000 / var2 : 100;
  103.       var1 = ((Applet)this).getParameter("style");
  104.       if (var1 != null && var1.equalsIgnoreCase("separator")) {
  105.          this.isBullet = false;
  106.       }
  107.  
  108.       var1 = ((Applet)this).getParameter("smoothness");
  109.       if (var1 != null) {
  110.          try {
  111.             this.smoothness = Integer.parseInt(var1);
  112.          } catch (NumberFormatException var8) {
  113.          }
  114.       }
  115.  
  116.       if (this.smoothness < 1) {
  117.          System.out.println("smoothness value of " + this.smoothness + " is invalid, setting value to 1");
  118.          this.smoothness = 1;
  119.       }
  120.  
  121.       var1 = ((Applet)this).getParameter("fadeAmount");
  122.       if (var1 != null) {
  123.          try {
  124.             this.fadeAmount = Integer.parseInt(var1);
  125.          } catch (NumberFormatException var7) {
  126.          }
  127.       }
  128.  
  129.       if (this.fadeAmount < 1) {
  130.          System.out.println("fadeAmount value of " + this.fadeAmount + " is invalid, setting value to 1");
  131.          this.fadeAmount = 1;
  132.       }
  133.  
  134.       var1 = ((Applet)this).getParameter("displayColors");
  135.       if (var1 != null) {
  136.          try {
  137.             this.displayColors = Integer.parseInt(var1);
  138.          } catch (NumberFormatException var6) {
  139.          }
  140.       }
  141.  
  142.       if (this.displayColors < 1) {
  143.          System.out.println("displayColor value of " + this.displayColors + " is invalid, setting value to 1");
  144.          this.displayColors = 1;
  145.       }
  146.  
  147.       var1 = ((Applet)this).getParameter("effect");
  148.       if (var1 != null) {
  149.          var1 = var1.toLowerCase();
  150.          if (var1.equals("fade")) {
  151.             this.effect = 1;
  152.             this.direction = 0;
  153.          } else if (var1.equals("fadeleft")) {
  154.             this.effect = 1;
  155.             this.direction = 1;
  156.          } else if (var1.equals("faderight")) {
  157.             this.effect = 1;
  158.             this.direction = 2;
  159.          } else if (var1.equals("fadeup")) {
  160.             this.effect = 1;
  161.             this.direction = 3;
  162.          } else if (var1.equals("fadedown")) {
  163.             this.effect = 1;
  164.             this.direction = 4;
  165.          } else if (var1.equals("fadein")) {
  166.             this.effect = 1;
  167.             this.direction = 5;
  168.          } else if (var1.equals("fadeout")) {
  169.             this.effect = 1;
  170.             this.direction = 6;
  171.          } else if (var1.equals("cycleleft")) {
  172.             this.effect = 0;
  173.             this.direction = 1;
  174.          } else if (var1.equals("cycleright")) {
  175.             this.effect = 0;
  176.             this.direction = 2;
  177.          } else if (var1.equals("cycleup")) {
  178.             this.effect = 0;
  179.             this.direction = 3;
  180.          } else if (var1.equals("cycledown")) {
  181.             this.effect = 0;
  182.             this.direction = 4;
  183.          } else if (var1.equals("cyclein")) {
  184.             this.effect = 0;
  185.             this.direction = 5;
  186.          } else if (var1.equals("cycleout")) {
  187.             this.effect = 0;
  188.             this.direction = 6;
  189.          } else if (var1.equals("cycle")) {
  190.             this.effect = 0;
  191.             this.direction = 0;
  192.          }
  193.  
  194.          switch (this.direction) {
  195.             case 0:
  196.                this.displayColors = 1;
  197.                break;
  198.             case 1:
  199.             case 2:
  200.                if (this.displayColors > ((Component)this).size().width) {
  201.                   this.displayColors = ((Component)this).size().width;
  202.                }
  203.                break;
  204.             case 3:
  205.             case 4:
  206.                if (this.displayColors > ((Component)this).size().height) {
  207.                   this.displayColors = ((Component)this).size().height;
  208.                }
  209.                break;
  210.             case 5:
  211.             case 6:
  212.                if (((Component)this).size().width > ((Component)this).size().height) {
  213.                   if (this.displayColors > ((Component)this).size().width / 2) {
  214.                      this.displayColors = ((Component)this).size().width / 2;
  215.                   }
  216.                } else if (this.displayColors > ((Component)this).size().height / 2) {
  217.                   this.displayColors = ((Component)this).size().height / 2;
  218.                }
  219.          }
  220.       }
  221.  
  222.       if (this.displayColors > this.smoothness) {
  223.          this.smoothness = this.displayColors;
  224.       }
  225.  
  226.       this.displayList = new Color[this.smoothness];
  227.  
  228.       for(int var3 = 0; var3 < this.smoothness; ++var3) {
  229.          this.displayList[var3] = this.currentColor;
  230.       }
  231.  
  232.       var1 = ((Applet)this).getParameter("pause");
  233.       this.pauseTime = this.convertTime("pause", var1, (double)0.0F);
  234.       var1 = ((Applet)this).getParameter("colors");
  235.       if (var1 != null && !var1.equalsIgnoreCase("rainbow")) {
  236.          int var4 = 0;
  237.          StringTokenizer var5 = new StringTokenizer(var1, "\t\n\r,");
  238.  
  239.          for(this.colors = new int[var5.countTokens()]; var5.hasMoreTokens(); ++var4) {
  240.             this.colors[var4] = this.getColor(var5.nextToken(), 0);
  241.          }
  242.       } else {
  243.          this.colors = new int[6];
  244.          this.colors[0] = 16711680;
  245.          this.colors[1] = 16762880;
  246.          this.colors[2] = 16776960;
  247.          this.colors[3] = 65280;
  248.          this.colors[4] = 255;
  249.          this.colors[5] = 13107455;
  250.       }
  251.  
  252.       this.displayCounter = this.smoothness;
  253.       this.field_2 = this.bgColor.getRGB() >> 16 & 255;
  254.       this.field_3 = this.bgColor.getRGB() >> 8 & 255;
  255.       this.field_4 = this.bgColor.getRGB() & 255;
  256.       if (this.effect == 1) {
  257.          this.ToR = this.colors[0] >> 16 & 255;
  258.          this.ToG = this.colors[0] >> 8 & 255;
  259.          this.ToB = this.colors[0] & 255;
  260.       }
  261.  
  262.    }
  263.  
  264.    public void start() {
  265.       appStart(this);
  266.    }
  267.  
  268.    public static synchronized void appStart(Bullets var0) {
  269.       if (uniqueAppList != null) {
  270.          for(int var1 = 0; var1 < uniqueAppList.length; ++var1) {
  271.             Bullets var2 = uniqueAppList[var1];
  272.             if (((Component)var0).size().width == ((Component)var2).size().width && ((Component)var0).size().height == ((Component)var2).size().height && var0.effect == var2.effect && var0.bgColor.getRGB() == var2.bgColor.getRGB() && var0.delay == var2.delay && var0.direction == var2.direction && var0.isBullet == var2.isBullet && var0.delay == var2.delay && var0.fadeAmount == var2.fadeAmount && var0.displayColors == var2.displayColors && var0.smoothness == var2.smoothness) {
  273.                var2.addApp(var0);
  274.                return;
  275.             }
  276.          }
  277.       }
  278.  
  279.       var0.master = var0;
  280.       var0.offImage = ((Component)var0).createImage(((Component)var0).size().width, ((Component)var0).size().height);
  281.       var0.offGraphic = var0.offImage.getGraphics();
  282.       var0.offGraphic.setColor(var0.bgColor);
  283.       var0.offGraphic.fillRect(0, 0, ((Component)var0).size().width, ((Component)var0).size().height);
  284.       var0.slaveList = new Bullets[1];
  285.       var0.slaveList[0] = var0;
  286.       if (uniqueAppList == null) {
  287.          uniqueAppList = new Bullets[1];
  288.          uniqueAppList[0] = var0;
  289.          threadMaster = var0;
  290.          threadMaster.mainThread = new Thread(threadMaster);
  291.          threadMaster.mainThread.start();
  292.       } else {
  293.          Bullets[] var3 = new Bullets[uniqueAppList.length + 1];
  294.          System.arraycopy(uniqueAppList, 0, var3, 0, uniqueAppList.length);
  295.          var3[uniqueAppList.length] = var0;
  296.          uniqueAppList = var3;
  297.       }
  298.    }
  299.  
  300.    public static synchronized void stopUniqueApp(Bullets var0) {
  301.       if (var0.slaveList == null) {
  302.          var0.master.removeApp(var0);
  303.       } else if (uniqueAppList.length == 1 && var0.slaveList.length == 1) {
  304.          var0.slaveList = null;
  305.          var0.mainThread.stop();
  306.          threadMaster = null;
  307.          uniqueAppList = null;
  308.       } else {
  309.          if (var0.slaveList.length > 1) {
  310.             for(int var1 = 0; var1 < uniqueAppList.length; ++var1) {
  311.                if (var0 == uniqueAppList[var1]) {
  312.                   uniqueAppList[var1] = var0.slaveList[1];
  313.                }
  314.             }
  315.  
  316.             var0.slaveList[1].takeMaster();
  317.             var0.slaveList = null;
  318.          } else {
  319.             Bullets[] var4 = new Bullets[uniqueAppList.length - 1];
  320.             int var2 = 0;
  321.  
  322.             for(int var3 = 0; var3 < uniqueAppList.length; ++var3) {
  323.                if (var0 != uniqueAppList[var3] && uniqueAppList[var3] != null) {
  324.                   var4[var2++] = uniqueAppList[var3];
  325.                }
  326.             }
  327.  
  328.             uniqueAppList = var4;
  329.          }
  330.  
  331.          if (threadMaster == var0) {
  332.             var0.mainThread.stop();
  333.             threadMaster = uniqueAppList[0];
  334.             threadMaster.mainThread = new Thread(threadMaster);
  335.             threadMaster.mainThread.start();
  336.          }
  337.  
  338.       }
  339.    }
  340.  
  341.    public synchronized void takeMaster() {
  342.       this.slaveList = new Bullets[this.master.slaveList.length - 1];
  343.       System.arraycopy(this.master.slaveList, 1, this.slaveList, 0, this.slaveList.length);
  344.       this.offGraphic = this.master.offGraphic;
  345.       this.offImage = this.master.offImage;
  346.       this.displayList = this.master.displayList;
  347.       this.currentColor = this.master.currentColor;
  348.       this.displayCounter = this.master.displayCounter;
  349.       this.fadeCounter = this.master.fadeCounter;
  350.       this.field_2 = this.master.field_2;
  351.       this.field_3 = this.master.field_3;
  352.       this.field_4 = this.master.field_4;
  353.       this.ToR = this.master.ToR;
  354.       this.ToG = this.master.ToG;
  355.       this.ToB = this.master.ToB;
  356.  
  357.       for(int var1 = 0; var1 < this.slaveList.length; ++var1) {
  358.          this.slaveList[var1].master = this;
  359.       }
  360.  
  361.    }
  362.  
  363.    public synchronized void addApp(Bullets var1) {
  364.       Bullets[] var2 = new Bullets[this.slaveList.length + 1];
  365.       System.arraycopy(this.slaveList, 0, var2, 0, this.slaveList.length);
  366.       var2[this.slaveList.length] = var1;
  367.       this.slaveList = var2;
  368.       var1.master = this;
  369.    }
  370.  
  371.    public synchronized void removeApp(Bullets var1) {
  372.       if (this.slaveList != null && this.slaveList.length != 1) {
  373.          Bullets[] var2 = new Bullets[this.slaveList.length - 1];
  374.          int var3 = 0;
  375.  
  376.          for(int var4 = 0; var4 < this.slaveList.length; ++var4) {
  377.             if (var1 != this.slaveList[var4] && this.slaveList[var4] != null) {
  378.                var2[var3++] = this.slaveList[var4];
  379.             }
  380.          }
  381.  
  382.          this.slaveList = var2;
  383.       } else {
  384.          this.slaveList = null;
  385.       }
  386.    }
  387.  
  388.    public void stop() {
  389.       stopUniqueApp(this);
  390.    }
  391.  
  392.    public void paint(Graphics var1) {
  393.       if (this.master != null) {
  394.          var1.drawImage(this.master.offImage, 0, 0, this);
  395.       }
  396.  
  397.    }
  398.  
  399.    public int getColor(String var1, int var2) {
  400.       if (var1 == null) {
  401.          return var2;
  402.       } else {
  403.          var1 = var1.toLowerCase().trim();
  404.          if (var1.equals("black")) {
  405.             return 0;
  406.          } else if (var1.equals("blue")) {
  407.             return 255;
  408.          } else if (var1.equals("cyan")) {
  409.             return 65535;
  410.          } else if (var1.equals("darkgray")) {
  411.             return 4210752;
  412.          } else if (var1.equals("gray")) {
  413.             return 8421504;
  414.          } else if (var1.equals("green")) {
  415.             return 65280;
  416.          } else if (var1.equals("lightgray")) {
  417.             return 12632256;
  418.          } else if (var1.equals("magenta")) {
  419.             return 16711935;
  420.          } else if (var1.equals("orange")) {
  421.             return 16762880;
  422.          } else if (var1.equals("pink")) {
  423.             return 16756655;
  424.          } else if (var1.equals("red")) {
  425.             return 16711680;
  426.          } else if (var1.equals("white")) {
  427.             return 16777215;
  428.          } else if (var1.equals("yellow")) {
  429.             return 16776960;
  430.          } else {
  431.             try {
  432.                return Integer.parseInt(var1, 16);
  433.             } catch (NumberFormatException var5) {
  434.                String var3 = var1.substring(1);
  435.  
  436.                try {
  437.                   return Integer.parseInt(var3, 16);
  438.                } catch (NumberFormatException var4) {
  439.                   System.out.println("Could not parse: '" + var1 + "' into a color");
  440.                   System.out.println("Using default value instead");
  441.                   return var2;
  442.                }
  443.             }
  444.          }
  445.       }
  446.    }
  447.  
  448.    private static synchronized long updateApps() {
  449.       if (uniqueAppList == null) {
  450.          return 0L;
  451.       } else {
  452.          long var0 = System.currentTimeMillis();
  453.          long var2 = Long.MAX_VALUE;
  454.  
  455.          for(int var4 = 0; var4 < uniqueAppList.length; ++var4) {
  456.             Bullets var5 = uniqueAppList[var4];
  457.             if (var5.nextUpdateTime < var0) {
  458.                var5.draw();
  459.             }
  460.  
  461.             if (var5.nextUpdateTime < var2) {
  462.                var2 = var5.nextUpdateTime;
  463.             }
  464.          }
  465.  
  466.          return var2;
  467.       }
  468.    }
  469.  
  470.    public void run() {
  471.       while(threadMaster == this) {
  472.          long var1 = updateApps() - System.currentTimeMillis();
  473.  
  474.          try {
  475.             if (var1 > 0L) {
  476.                Thread.sleep(var1);
  477.             }
  478.          } catch (InterruptedException var3) {
  479.          }
  480.       }
  481.  
  482.       this.mainThread = null;
  483.    }
  484.  
  485.    private void fadeColor() {
  486.       if (this.field_2 > this.ToR) {
  487.          this.field_2 -= this.fadeAmount;
  488.          if (this.field_2 < this.ToR) {
  489.             this.field_2 = this.ToR;
  490.          }
  491.       } else if (this.field_2 < this.ToR) {
  492.          this.field_2 += this.fadeAmount;
  493.          if (this.field_2 > this.ToR) {
  494.             this.field_2 = this.ToR;
  495.          }
  496.       }
  497.  
  498.       if (this.field_3 > this.ToG) {
  499.          this.field_3 -= this.fadeAmount;
  500.          if (this.field_3 < this.ToG) {
  501.             this.field_3 = this.ToG;
  502.          }
  503.       } else if (this.field_3 < this.ToG) {
  504.          this.field_3 += this.fadeAmount;
  505.          if (this.field_3 > this.ToG) {
  506.             this.field_3 = this.ToG;
  507.          }
  508.       }
  509.  
  510.       if (this.field_4 > this.ToB) {
  511.          this.field_4 -= this.fadeAmount;
  512.          if (this.field_4 < this.ToB) {
  513.             this.field_4 = this.ToB;
  514.             return;
  515.          }
  516.       } else if (this.field_4 < this.ToB) {
  517.          this.field_4 += this.fadeAmount;
  518.          if (this.field_4 > this.ToB) {
  519.             this.field_4 = this.ToB;
  520.          }
  521.       }
  522.  
  523.    }
  524.  
  525.    public synchronized void draw() {
  526.       if (this.slaveList != null) {
  527.          for(int var1 = this.displayList.length; var1 > 1; this.displayList[var1] = this.displayList[var1 - 1]) {
  528.             --var1;
  529.          }
  530.  
  531.          this.displayList[0] = this.currentColor;
  532.          int var2 = this.displayList.length;
  533.          Dimension var3 = ((Component)this).size();
  534.  
  535.          for(int var4 = 0; var4 < this.displayList.length; ++var4) {
  536.             this.offGraphic.setColor(this.displayList[var4]);
  537.             int var5 = var2 * var3.width / this.displayList.length;
  538.             int var6 = var2 * var3.height / this.displayList.length;
  539.             --var2;
  540.             switch (this.direction) {
  541.                case 0:
  542.                   if (this.isBullet) {
  543.                      this.offGraphic.fillOval(0, 0, var3.width, var3.height);
  544.                   } else {
  545.                      this.offGraphic.fillRect(0, 0, var3.width, var3.height);
  546.                   }
  547.                   break;
  548.                case 2:
  549.                   this.offGraphic.setColor(this.displayList[var2]);
  550.                case 1:
  551.                   if (this.isBullet) {
  552.                      if (this.direction == 2) {
  553.                         this.offGraphic.setColor(this.displayList[this.displayList.length - 1 - var4 / 2]);
  554.                      } else {
  555.                         this.offGraphic.setColor(this.displayList[var4 / 2]);
  556.                      }
  557.  
  558.                      this.offGraphic.fillArc((var3.width - var5) / 2, 0, var5, var3.height, 270, 180);
  559.                      if (this.direction == 2) {
  560.                         this.offGraphic.setColor(this.displayList[var4 / 2]);
  561.                      } else {
  562.                         this.offGraphic.setColor(this.displayList[this.displayList.length - 1 - var4 / 2]);
  563.                      }
  564.  
  565.                      this.offGraphic.fillArc((var3.width - var5) / 2, 0, var5, var3.height, 90, 180);
  566.                   } else {
  567.                      this.offGraphic.fillRect(0, 0, var5, var3.height);
  568.                   }
  569.                   break;
  570.                case 4:
  571.                   this.offGraphic.setColor(this.displayList[var2]);
  572.                case 3:
  573.                   if (this.isBullet) {
  574.                      if (this.direction == 4) {
  575.                         this.offGraphic.setColor(this.displayList[this.displayList.length - 1 - var4 / 2]);
  576.                      } else {
  577.                         this.offGraphic.setColor(this.displayList[var4 / 2]);
  578.                      }
  579.  
  580.                      this.offGraphic.fillArc(0, (var3.height - var6) / 2, var3.width, var6, 180, 180);
  581.                      if (this.direction == 4) {
  582.                         this.offGraphic.setColor(this.displayList[var4 / 2]);
  583.                      } else {
  584.                         this.offGraphic.setColor(this.displayList[this.displayList.length - 1 - var4 / 2]);
  585.                      }
  586.  
  587.                      this.offGraphic.fillArc(0, (var3.height - var6) / 2, var3.width, var6, 0, 180);
  588.                   } else {
  589.                      this.offGraphic.fillRect(0, 0, var3.width, var6);
  590.                   }
  591.                   break;
  592.                case 6:
  593.                   this.offGraphic.setColor(this.displayList[var2]);
  594.                case 5:
  595.                   if (this.isBullet) {
  596.                      this.offGraphic.fillOval((var3.width - var5) / 2, (var3.height - var6) / 2, var5, var6);
  597.                   } else {
  598.                      this.offGraphic.fillRect((var3.width - var5) / 2, (var3.height - var6) / 2, var5, var6);
  599.                   }
  600.             }
  601.          }
  602.  
  603.          for(int var8 = 0; var8 < this.slaveList.length; ++var8) {
  604.             try {
  605.                this.slaveList[var8].getGraphics().drawImage(this.offImage, 0, 0, this);
  606.             } catch (Exception var7) {
  607.             }
  608.          }
  609.  
  610.          this.nextUpdateTime = System.currentTimeMillis() + (long)this.delay;
  611.          if (++this.displayCounter > this.displayList.length / this.displayColors) {
  612.             this.displayCounter = 0;
  613.             if (this.effect == 1) {
  614.                if (this.field_2 == this.ToR && this.field_4 == this.ToB && this.field_3 == this.ToG) {
  615.                   if (this.pauseTime > 0) {
  616.                      if (++this.fadeCounter >= this.displayColors) {
  617.                         this.fadeCounter = 0;
  618.                         this.nextUpdateTime = System.currentTimeMillis() + (long)this.pauseTime;
  619.                         ++this.colorIndex;
  620.                         if (this.colorIndex == this.colors.length) {
  621.                            this.colorIndex = 0;
  622.                         }
  623.  
  624.                         this.ToR = this.colors[this.colorIndex] >> 16 & 255;
  625.                         this.ToG = this.colors[this.colorIndex] >> 8 & 255;
  626.                         this.ToB = this.colors[this.colorIndex] & 255;
  627.                      }
  628.                   } else {
  629.                      ++this.colorIndex;
  630.                      if (this.colorIndex == this.colors.length) {
  631.                         this.colorIndex = 0;
  632.                      }
  633.  
  634.                      this.ToR = this.colors[this.colorIndex] >> 16 & 255;
  635.                      this.ToG = this.colors[this.colorIndex] >> 8 & 255;
  636.                      this.ToB = this.colors[this.colorIndex] & 255;
  637.                   }
  638.                } else {
  639.                   this.fadeColor();
  640.                }
  641.             } else {
  642.                ++this.colorIndex;
  643.                if (this.colorIndex == this.colors.length) {
  644.                   this.colorIndex = 0;
  645.                }
  646.  
  647.                this.field_2 = this.colors[this.colorIndex] >> 16 & 255;
  648.                this.field_3 = this.colors[this.colorIndex] >> 8 & 255;
  649.                this.field_4 = this.colors[this.colorIndex] & 255;
  650.                if (this.pauseTime > 0) {
  651.                   this.nextUpdateTime = System.currentTimeMillis() + (long)this.pauseTime;
  652.                }
  653.             }
  654.  
  655.             this.currentColor = new Color(this.field_2, this.field_3, this.field_4);
  656.          }
  657.  
  658.       }
  659.    }
  660. }
  661.