import java.nio.ByteBuffer;

public class Class8_Sub5 extends Class8 {

   int anInt9610;
   Interface33 anInterface33_9611;
   Interface35 anInterface35_9612;
   Class545_Sub2 aClass545_Sub2_9613;
   byte[] aByteArray9614 = new byte[512];
   int anInt9615;


   void w(char var1, int var2, int var3, int var4, boolean var5) {
      if(this.aClass545_Sub2_9613.method14995() != Class349.aClass349_4449) {
         var2 += this.aByteArray9614[var1 * 2];
         var3 += this.aByteArray9614[var1 * 2 + 1];
         this.aClass545_Sub2_9613.aClass372_9727.method6514((float)var2, (float)var3, (float)(var2 + this.anInt9615), (float)(var3 + this.anInt9615), (float)(var1 % 16) / 16.0F * this.anInterface33_9611.method190(), (float)(var1 / 16) / 16.0F * this.anInterface33_9611.method191(), (float)(var1 % 16 + 1) / 16.0F * this.anInterface33_9611.method190(), (float)(var1 / 16 + 1) / 16.0F * this.anInterface33_9611.method191(), this.anInterface33_9611, var4);
      } else {
         this.aClass545_Sub2_9613.method15015();
         this.aClass545_Sub2_9613.method15173(1);
         Class62 var6 = this.aClass545_Sub2_9613.aClass62_9731;
         var6.anInterface33_572 = this.anInterface33_9611;
         var6.method1301(0, var4);
         float var7 = (float)this.aClass545_Sub2_9613.method11482((byte)14).method2741();
         float var8 = (float)this.aClass545_Sub2_9613.method11482((byte)14).method2742();
         var6.aClass317_575.method5616(2.0F / var7, 2.0F / var8, 1.0F, 1.0F);
         var6.aClass317_575.aFloatArray4000[12] = ((float)var2 + this.aClass545_Sub2_9613.method14983()) * 2.0F / var7 - 1.0F;
         var6.aClass317_575.aFloatArray4000[13] = ((float)var3 + this.aClass545_Sub2_9613.method14983()) * 2.0F / var8 - 1.0F;
         var6.aClass317_575.aFloatArray4000[14] = -1.0F;
         var6.aClass317_574.method5733();
         var6.anInterface35_577 = this.anInterface35_9612;
         var6.anInt578 = var1 * 4;
         var6.aClass341_579 = this.aClass545_Sub2_9613.aClass341_9777;
         var6.method1302();
      }

   }

   Class8_Sub5(Class545_Sub2 var1, Class405 var2, Class86_Sub1[] var3, boolean var4) {
      super(var1, var2);
      this.aClass545_Sub2_9613 = var1;
      this.anInt9615 = 0;

      for(int var5 = 0; var5 < 256; ++var5) {
         Class86_Sub1 var6 = var3[var5];
         if(var6.anInt9470 > this.anInt9615) {
            this.anInt9615 = var6.anInt9470;
         }

         if(var6.anInt9468 > this.anInt9615) {
            this.anInt9615 = var6.anInt9468;
         }
      }

      this.anInt9610 = this.anInt9615 * 16;
      Class86_Sub1 var7;
      int var8;
      int var10;
      int var11;
      int var12;
      int var13;
      int var15;
      int var16;
      int var23;
      if(var4) {
         byte[] var21 = new byte[this.anInt9610 * this.anInt9610];

         for(var23 = 0; var23 < 256; ++var23) {
            var7 = var3[var23];
            var8 = var7.anInt9470;
            int var9 = var7.anInt9468;
            var10 = var23 % 16 * this.anInt9615;
            var11 = var23 / 16 * this.anInt9615;
            var12 = var11 * this.anInt9610 + var10;
            var13 = 0;
            byte[] var14;
            if(var7.aByteArray9473 == null) {
               var14 = var7.aByteArray9472;

               for(var15 = 0; var15 < var8; ++var15) {
                  for(var16 = 0; var16 < var9; ++var16) {
                     var21[var12++] = (byte)(var14[var13++] == 0?0:-1);
                  }

                  var12 += this.anInt9610 - var9;
               }
            } else {
               var14 = var7.aByteArray9473;

               for(var15 = 0; var15 < var8; ++var15) {
                  for(var16 = 0; var16 < var9; ++var16) {
                     var21[var12++] = var14[var13++];
                  }

                  var12 += this.anInt9610 - var9;
               }
            }
         }

         int[] var25 = new int[var21.length];

         for(int var24 = 0; var24 < var21.length; ++var24) {
            var25[var24] = var21[var24] << 24 | var21[var24] << 16 | var21[var24] << 8 | var21[var24];
         }

         this.anInterface33_9611 = var1.method15040(this.anInt9610, this.anInt9610, false, var25);
      } else {
         int[] var20 = new int[this.anInt9610 * this.anInt9610];

         for(var23 = 0; var23 < 256; ++var23) {
            var7 = var3[var23];
            int[] var28 = var7.anIntArray9466;
            byte[] var29 = var7.aByteArray9473;
            byte[] var31 = var7.aByteArray9472;
            var11 = var7.anInt9470;
            var12 = var7.anInt9468;
            var13 = var23 % 16 * this.anInt9615;
            int var33 = var23 / 16 * this.anInt9615;
            var15 = var33 * this.anInt9610 + var13;
            var16 = 0;
            int var17;
            int var18;
            if(var29 != null) {
               for(var17 = 0; var17 < var11; ++var17) {
                  for(var18 = 0; var18 < var12; ++var18) {
                     var20[var15++] = var29[var16] << 24 | var28[var31[var16] & 255];
                     ++var16;
                  }

                  var15 += this.anInt9610 - var12;
               }
            } else {
               for(var17 = 0; var17 < var11; ++var17) {
                  for(var18 = 0; var18 < var12; ++var18) {
                     byte var19;
                     if((var19 = var31[var16++]) != 0) {
                        var20[var15++] = -16777216 | var28[var19 & 255];
                     } else {
                        ++var15;
                     }
                  }

                  var15 += this.anInt9610 - var12;
               }
            }
         }

         this.anInterface33_9611 = var1.method15040(this.anInt9610, this.anInt9610, false, var20);
      }

      this.anInterface33_9611.method224(Class353.aClass353_4463);
      this.anInterface35_9612 = var1.method15237(false);
      this.anInterface35_9612.method220(20480, 20);
      ByteBuffer var22 = this.aClass545_Sub2_9613.aByteBuffer9763;
      var22.clear();
      float var26 = this.anInterface33_9611.method184((float)this.anInt9610) / (float)this.anInt9610;
      float var27 = this.anInterface33_9611.method185((float)this.anInt9610) / (float)this.anInt9610;

      Class86_Sub1 var30;
      for(var8 = 0; var8 < 256; ++var8) {
         var30 = var3[var8];
         var10 = var30.anInt9470;
         var11 = var30.anInt9468;
         var12 = var30.anInt9469;
         var13 = var30.anInt9467;
         float var32 = (float)(var8 % 16 * this.anInt9615);
         float var38 = (float)(var8 / 16 * this.anInt9615);
         float var37 = var32 * var26;
         float var36 = var38 * var27;
         float var35 = (var32 + (float)var11) * var26;
         float var34 = (var38 + (float)var10) * var27;
         var22.putFloat((float)var13);
         var22.putFloat((float)var12);
         var22.putFloat(0.0F);
         var22.putFloat(var37);
         var22.putFloat(var36);
         var22.putFloat((float)var13);
         var22.putFloat((float)(var12 + var10));
         var22.putFloat(0.0F);
         var22.putFloat(var37);
         var22.putFloat(var34);
         var22.putFloat((float)(var13 + var11));
         var22.putFloat((float)(var12 + var10));
         var22.putFloat(0.0F);
         var22.putFloat(var35);
         var22.putFloat(var34);
         var22.putFloat((float)(var13 + var11));
         var22.putFloat((float)var12);
         var22.putFloat(0.0F);
         var22.putFloat(var35);
         var22.putFloat(var36);
      }

      this.anInterface35_9612.method217(0, var22.position(), this.aClass545_Sub2_9613.aLong9730);
      var1.method14974(12);

      for(var8 = 0; var8 < 256; ++var8) {
         var30 = var3[var8];
         this.aByteArray9614[var8 * 2] = (byte)var30.anInt9467;
         this.aByteArray9614[var8 * 2 + 1] = (byte)var30.anInt9469;
      }

   }

   void method620(char var1, int var2, int var3, int var4, boolean var5, Class496 var6, int var7, int var8) {}

   void UA(char var1, int var2, int var3, int var4, boolean var5) {
      if(this.aClass545_Sub2_9613.method14995() != Class349.aClass349_4449) {
         var2 += this.aByteArray9614[var1 * 2];
         var3 += this.aByteArray9614[var1 * 2 + 1];
         this.aClass545_Sub2_9613.aClass372_9727.method6514((float)var2, (float)var3, (float)(var2 + this.anInt9615), (float)(var3 + this.anInt9615), (float)(var1 % 16) / 16.0F * this.anInterface33_9611.method190(), (float)(var1 / 16) / 16.0F * this.anInterface33_9611.method191(), (float)(var1 % 16 + 1) / 16.0F * this.anInterface33_9611.method190(), (float)(var1 / 16 + 1) / 16.0F * this.anInterface33_9611.method191(), this.anInterface33_9611, var4);
      } else {
         this.aClass545_Sub2_9613.method15015();
         this.aClass545_Sub2_9613.method15173(1);
         Class62 var6 = this.aClass545_Sub2_9613.aClass62_9731;
         var6.anInterface33_572 = this.anInterface33_9611;
         var6.method1301(0, var4);
         float var7 = (float)this.aClass545_Sub2_9613.method11482((byte)14).method2741();
         float var8 = (float)this.aClass545_Sub2_9613.method11482((byte)14).method2742();
         var6.aClass317_575.method5616(2.0F / var7, 2.0F / var8, 1.0F, 1.0F);
         var6.aClass317_575.aFloatArray4000[12] = ((float)var2 + this.aClass545_Sub2_9613.method14983()) * 2.0F / var7 - 1.0F;
         var6.aClass317_575.aFloatArray4000[13] = ((float)var3 + this.aClass545_Sub2_9613.method14983()) * 2.0F / var8 - 1.0F;
         var6.aClass317_575.aFloatArray4000[14] = -1.0F;
         var6.aClass317_574.method5733();
         var6.anInterface35_577 = this.anInterface35_9612;
         var6.anInt578 = var1 * 4;
         var6.aClass341_579 = this.aClass545_Sub2_9613.aClass341_9777;
         var6.method1302();
      }

   }

   void k(char var1, int var2, int var3, int var4, boolean var5) {
      if(this.aClass545_Sub2_9613.method14995() != Class349.aClass349_4449) {
         var2 += this.aByteArray9614[var1 * 2];
         var3 += this.aByteArray9614[var1 * 2 + 1];
         this.aClass545_Sub2_9613.aClass372_9727.method6514((float)var2, (float)var3, (float)(var2 + this.anInt9615), (float)(var3 + this.anInt9615), (float)(var1 % 16) / 16.0F * this.anInterface33_9611.method190(), (float)(var1 / 16) / 16.0F * this.anInterface33_9611.method191(), (float)(var1 % 16 + 1) / 16.0F * this.anInterface33_9611.method190(), (float)(var1 / 16 + 1) / 16.0F * this.anInterface33_9611.method191(), this.anInterface33_9611, var4);
      } else {
         this.aClass545_Sub2_9613.method15015();
         this.aClass545_Sub2_9613.method15173(1);
         Class62 var6 = this.aClass545_Sub2_9613.aClass62_9731;
         var6.anInterface33_572 = this.anInterface33_9611;
         var6.method1301(0, var4);
         float var7 = (float)this.aClass545_Sub2_9613.method11482((byte)14).method2741();
         float var8 = (float)this.aClass545_Sub2_9613.method11482((byte)14).method2742();
         var6.aClass317_575.method5616(2.0F / var7, 2.0F / var8, 1.0F, 1.0F);
         var6.aClass317_575.aFloatArray4000[12] = ((float)var2 + this.aClass545_Sub2_9613.method14983()) * 2.0F / var7 - 1.0F;
         var6.aClass317_575.aFloatArray4000[13] = ((float)var3 + this.aClass545_Sub2_9613.method14983()) * 2.0F / var8 - 1.0F;
         var6.aClass317_575.aFloatArray4000[14] = -1.0F;
         var6.aClass317_574.method5733();
         var6.anInterface35_577 = this.anInterface35_9612;
         var6.anInt578 = var1 * 4;
         var6.aClass341_579 = this.aClass545_Sub2_9613.aClass341_9777;
         var6.method1302();
      }

   }

   void method629(char var1, int var2, int var3, int var4, boolean var5, Class496 var6, int var7, int var8) {}
}
