import jaggl.OpenGL;

public class Class141_Sub4 extends Class141 {

   static final int anInt9899 = 5;
   static final char aChar9900 = '\u0000';
   static final int anInt9901 = 128;
   static final int anInt9902 = 24;
   static final float aFloat9903 = 26.0F;
   static final float aFloat9904 = -12.0F;
   static final int anInt9905 = 128;
   static final float aFloat9906 = 0.0F;
   static final char aChar9907 = '\u0001';
   Class149 aClass149_9908;
   boolean aBool9909;
   boolean aBool9910 = false;
   Class147_Sub1[] aClass147_Sub1Array9911;


   Class141_Sub4(Class545_Sub1 var1) {
      super(var1);
      if(var1.aBool9274) {
         byte[][] var2 = new byte[6][16384];
         byte[][] var3 = new byte[6][16384];
         byte[][] var4 = new byte[6][16384];
         int var5 = 0;
         Class326 var6 = new Class326(0.0F, -1.0F, 0.0F);

         for(int var7 = 0; var7 < 128; ++var7) {
            for(int var8 = 0; var8 < 128; ++var8) {
               float var9 = 2.0F * (float)var8 / 128.0F - 1.0F;
               float var10 = 2.0F * (float)var7 / 128.0F - 1.0F;
               float var11 = (float)(1.0D / Math.sqrt((double)(var9 * var9 + 1.0F + var10 * var10)));
               var9 *= var11;
               var10 *= var11;

               for(int var12 = 0; var12 < 6; ++var12) {
                  Class326 var13;
                  if(var12 == 0) {
                     var13 = new Class326(-var11, -var9, var10);
                  } else if(var12 == 1) {
                     var13 = new Class326(var11, var9, var10);
                  } else if(var12 == 2) {
                     var13 = new Class326(-var9, var10, -var11);
                  } else if(var12 == 3) {
                     var13 = new Class326(-var9, -var10, var11);
                  } else if(var12 == 4) {
                     var13 = new Class326(var9, var11, -var10);
                  } else {
                     var13 = new Class326(var9, -var11, var10);
                  }

                  float var14 = var13.method5939(var6);
                  var14 = Math.max(0.0F, Math.min(1.0F, var14));
                  int var15;
                  int var17;
                  int var16;
                  if(var14 > 0.0F) {
                     var15 = Math.min(255, (int)(Math.pow((double)var14, 128.0D) * 400.0D));
                     var16 = Math.min(255, (int)(Math.pow((double)var14, 24.0D) * 400.0D));
                     var17 = Math.min(255, (int)(Math.pow((double)var14, 5.0D) * 400.0D));
                  } else {
                     var17 = 0;
                     var16 = 0;
                     var15 = 0;
                  }

                  var3[var12][var5] = (byte)var15;
                  var4[var12][var5] = (byte)var16;
                  var2[var12][var5] = (byte)var17;
               }

               ++var5;
            }
         }

         this.aClass147_Sub1Array9911 = new Class147_Sub1[3];
         this.aClass147_Sub1Array9911[0] = new Class147_Sub1(this.aClass545_Sub1_1628, Class98.aClass98_987, Class91.aClass91_897, 128, false, var3, Class98.aClass98_987);
         this.aClass147_Sub1Array9911[1] = new Class147_Sub1(this.aClass545_Sub1_1628, Class98.aClass98_987, Class91.aClass91_897, 128, false, var4, Class98.aClass98_987);
         this.aClass147_Sub1Array9911[2] = new Class147_Sub1(this.aClass545_Sub1_1628, Class98.aClass98_987, Class91.aClass91_897, 128, false, var2, Class98.aClass98_987);
         this.method15434();
      }

   }

   void method2639(int var1, int var2) {
      if(this.aBool9910) {
         this.aClass545_Sub1_1628.method14641(1);
         this.aClass545_Sub1_1628.method14725(this.aClass147_Sub1Array9911[var1 - 1]);
         this.aClass545_Sub1_1628.method14641(0);
      }

   }

   void method15434() {
      this.aClass149_9908 = new Class149(this.aClass545_Sub1_1628, 2);
      this.aClass149_9908.method2735(0);
      this.aClass545_Sub1_1628.method14641(1);
      OpenGL.glTexGeni(8192, 9472, '\u8511');
      OpenGL.glTexGeni(8193, 9472, '\u8511');
      OpenGL.glTexGeni(8194, 9472, '\u8511');
      OpenGL.glEnable(3168);
      OpenGL.glEnable(3169);
      OpenGL.glEnable(3170);
      OpenGL.glMatrixMode(5890);
      OpenGL.glLoadIdentity();
      OpenGL.glRotatef(26.0F, 1.0F, 0.0F, 0.0F);
      OpenGL.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
      OpenGL.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
      OpenGL.glMatrixMode(5888);
      if(!this.aBool9909) {
         this.aClass545_Sub1_1628.method14553(7681, 8448);
         this.aClass545_Sub1_1628.method14679(0, '\u8578', 768);
         this.aClass545_Sub1_1628.method14641(2);
         this.aClass545_Sub1_1628.method14553(260, 7681);
         this.aClass545_Sub1_1628.method14679(0, '\u8578', 768);
         this.aClass545_Sub1_1628.method14679(1, '\u8578', 770);
         this.aClass545_Sub1_1628.method14630(0, '\u8577', 770);
      } else {
         this.aClass545_Sub1_1628.method14553(260, 7681);
         this.aClass545_Sub1_1628.method14679(0, 5890, 770);
         this.aClass545_Sub1_1628.method14630(0, '\u8577', 770);
      }

      this.aClass545_Sub1_1628.method14641(0);
      this.aClass149_9908.method2736();
      this.aClass149_9908.method2735(1);
      this.aClass545_Sub1_1628.method14641(1);
      OpenGL.glDisable(3168);
      OpenGL.glDisable(3169);
      OpenGL.glDisable(3170);
      OpenGL.glMatrixMode(5890);
      OpenGL.glLoadIdentity();
      OpenGL.glMatrixMode(5888);
      if(!this.aBool9909) {
         this.aClass545_Sub1_1628.method14553(8448, 8448);
         this.aClass545_Sub1_1628.method14679(0, 5890, 768);
         this.aClass545_Sub1_1628.method14641(2);
         this.aClass545_Sub1_1628.method14553(8448, 8448);
         this.aClass545_Sub1_1628.method14679(0, 5890, 768);
         this.aClass545_Sub1_1628.method14679(1, '\u8578', 768);
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      } else {
         this.aClass545_Sub1_1628.method14553(8448, 8448);
         this.aClass545_Sub1_1628.method14679(0, 5890, 768);
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      }

      this.aClass545_Sub1_1628.method14641(0);
      this.aClass149_9908.method2736();
   }

   void method2625(boolean var1) {
      if(this.aClass149_9908 != null && var1) {
         if(!this.aBool9909) {
            this.aClass545_Sub1_1628.method14641(2);
            this.aClass545_Sub1_1628.method14725(this.aClass545_Sub1_1628.aClass147_Sub4_9254);
            this.aClass545_Sub1_1628.method14641(0);
         }

         this.aClass149_9908.method2737('\u0000');
         this.aBool9910 = true;
      } else {
         this.aClass545_Sub1_1628.method14630(0, '\u8578', 770);
      }

   }

   void method2636(boolean var1) {
      this.aClass545_Sub1_1628.method14553(8448, 7681);
   }

   void method2630() {
      if(this.aBool9910) {
         if(!this.aBool9909) {
            this.aClass545_Sub1_1628.method14641(2);
            this.aClass545_Sub1_1628.method14725((Class147)null);
         }

         this.aClass545_Sub1_1628.method14641(1);
         this.aClass545_Sub1_1628.method14725((Class147)null);
         this.aClass545_Sub1_1628.method14641(0);
         this.aClass149_9908.method2737('\u0001');
         this.aBool9910 = false;
      } else {
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      }

      this.aClass545_Sub1_1628.method14553(8448, 8448);
   }

   void method2637(boolean var1) {
      this.aClass545_Sub1_1628.method14553(8448, 7681);
   }

   void method2628(Class147 var1, int var2) {
      this.aClass545_Sub1_1628.method14725(var1);
      this.aClass545_Sub1_1628.method14591(var2);
   }

   boolean method2629() {
      return true;
   }

   void method2631(boolean var1) {
      if(this.aClass149_9908 != null && var1) {
         if(!this.aBool9909) {
            this.aClass545_Sub1_1628.method14641(2);
            this.aClass545_Sub1_1628.method14725(this.aClass545_Sub1_1628.aClass147_Sub4_9254);
            this.aClass545_Sub1_1628.method14641(0);
         }

         this.aClass149_9908.method2737('\u0000');
         this.aBool9910 = true;
      } else {
         this.aClass545_Sub1_1628.method14630(0, '\u8578', 770);
      }

   }

   boolean method2633() {
      return true;
   }

   void method2632() {
      if(this.aBool9910) {
         if(!this.aBool9909) {
            this.aClass545_Sub1_1628.method14641(2);
            this.aClass545_Sub1_1628.method14725((Class147)null);
         }

         this.aClass545_Sub1_1628.method14641(1);
         this.aClass545_Sub1_1628.method14725((Class147)null);
         this.aClass545_Sub1_1628.method14641(0);
         this.aClass149_9908.method2737('\u0001');
         this.aBool9910 = false;
      } else {
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      }

      this.aClass545_Sub1_1628.method14553(8448, 8448);
   }

   void method2627(int var1, int var2) {
      if(this.aBool9910) {
         this.aClass545_Sub1_1628.method14641(1);
         this.aClass545_Sub1_1628.method14725(this.aClass147_Sub1Array9911[var1 - 1]);
         this.aClass545_Sub1_1628.method14641(0);
      }

   }

   void method2634(int var1, int var2) {
      if(this.aBool9910) {
         this.aClass545_Sub1_1628.method14641(1);
         this.aClass545_Sub1_1628.method14725(this.aClass147_Sub1Array9911[var1 - 1]);
         this.aClass545_Sub1_1628.method14641(0);
      }

   }

   void method15435() {
      this.aClass149_9908 = new Class149(this.aClass545_Sub1_1628, 2);
      this.aClass149_9908.method2735(0);
      this.aClass545_Sub1_1628.method14641(1);
      OpenGL.glTexGeni(8192, 9472, '\u8511');
      OpenGL.glTexGeni(8193, 9472, '\u8511');
      OpenGL.glTexGeni(8194, 9472, '\u8511');
      OpenGL.glEnable(3168);
      OpenGL.glEnable(3169);
      OpenGL.glEnable(3170);
      OpenGL.glMatrixMode(5890);
      OpenGL.glLoadIdentity();
      OpenGL.glRotatef(26.0F, 1.0F, 0.0F, 0.0F);
      OpenGL.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
      OpenGL.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
      OpenGL.glMatrixMode(5888);
      if(!this.aBool9909) {
         this.aClass545_Sub1_1628.method14553(7681, 8448);
         this.aClass545_Sub1_1628.method14679(0, '\u8578', 768);
         this.aClass545_Sub1_1628.method14641(2);
         this.aClass545_Sub1_1628.method14553(260, 7681);
         this.aClass545_Sub1_1628.method14679(0, '\u8578', 768);
         this.aClass545_Sub1_1628.method14679(1, '\u8578', 770);
         this.aClass545_Sub1_1628.method14630(0, '\u8577', 770);
      } else {
         this.aClass545_Sub1_1628.method14553(260, 7681);
         this.aClass545_Sub1_1628.method14679(0, 5890, 770);
         this.aClass545_Sub1_1628.method14630(0, '\u8577', 770);
      }

      this.aClass545_Sub1_1628.method14641(0);
      this.aClass149_9908.method2736();
      this.aClass149_9908.method2735(1);
      this.aClass545_Sub1_1628.method14641(1);
      OpenGL.glDisable(3168);
      OpenGL.glDisable(3169);
      OpenGL.glDisable(3170);
      OpenGL.glMatrixMode(5890);
      OpenGL.glLoadIdentity();
      OpenGL.glMatrixMode(5888);
      if(!this.aBool9909) {
         this.aClass545_Sub1_1628.method14553(8448, 8448);
         this.aClass545_Sub1_1628.method14679(0, 5890, 768);
         this.aClass545_Sub1_1628.method14641(2);
         this.aClass545_Sub1_1628.method14553(8448, 8448);
         this.aClass545_Sub1_1628.method14679(0, 5890, 768);
         this.aClass545_Sub1_1628.method14679(1, '\u8578', 768);
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      } else {
         this.aClass545_Sub1_1628.method14553(8448, 8448);
         this.aClass545_Sub1_1628.method14679(0, 5890, 768);
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      }

      this.aClass545_Sub1_1628.method14641(0);
      this.aClass149_9908.method2736();
   }

   void method2635(Class147 var1, int var2) {
      this.aClass545_Sub1_1628.method14725(var1);
      this.aClass545_Sub1_1628.method14591(var2);
   }

   void method2623() {
      if(this.aBool9910) {
         if(!this.aBool9909) {
            this.aClass545_Sub1_1628.method14641(2);
            this.aClass545_Sub1_1628.method14725((Class147)null);
         }

         this.aClass545_Sub1_1628.method14641(1);
         this.aClass545_Sub1_1628.method14725((Class147)null);
         this.aClass545_Sub1_1628.method14641(0);
         this.aClass149_9908.method2737('\u0001');
         this.aBool9910 = false;
      } else {
         this.aClass545_Sub1_1628.method14630(0, 5890, 770);
      }

      this.aClass545_Sub1_1628.method14553(8448, 8448);
   }

   void method2638(boolean var1) {
      this.aClass545_Sub1_1628.method14553(8448, 7681);
   }

   void method2624(boolean var1) {
      this.aClass545_Sub1_1628.method14553(8448, 7681);
   }

   boolean method2626() {
      return true;
   }
}
