import jagdx.IDirect3DDevice;
import jagdx.IUnknown;

public class Class151_Sub1_Sub1_Sub2 extends Class151_Sub1_Sub1 {

   Interface41 anInterface41_10704 = null;
   Class545_Sub2_Sub1 aClass545_Sub2_Sub1_10705;
   int anInt10706;
   int anInt10707;
   int anInt10708;
   static final int anInt10709 = 16;
   boolean aBool10710;
   Interface29[] anInterface29Array10711 = new Interface29[4];


   boolean method154() {
      for(int var1 = 0; var1 < 4; ++var1) {
         Interface29 var2 = this.anInterface29Array10711[var1];
         if(var2 != null) {
            long var3 = var2.method81();
            this.method16600(var1, var3);
         }
      }

      if(this.anInterface41_10704 != null) {
         this.method16601(this.anInterface41_10704.method81());
      }

      this.aBool10710 = true;
      return super.method154();
   }

   boolean method16599(int var1, long var2) {
      return Class23.method813(IDirect3DDevice.SetRenderTarget(this.aClass545_Sub2_Sub1_10705.aLong10294, var1, var2));
   }

   public int method2742() {
      return this.anInt10706;
   }

   public void method14467(Interface8 var1) {
      Interface41 var2 = (Interface41)var1;
      if(var1 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var2.method30() || this.anInt10706 != var2.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var2.method35();
            this.anInt10707 = var2.method30();
            this.method15768();
         }

         this.anInt10708 |= 16;
         this.anInterface41_10704 = var2;
         if(this.aBool10710) {
            this.method16601(var2.method81());
         }
      } else {
         this.anInt10708 &= -17;
         this.anInterface41_10704 = null;
         if(this.aBool10710) {
            this.method16601(0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   public void method14460(int var1, Interface7 var2) {
      int var3 = 1 << var1;
      Interface29 var4 = (Interface29)var2;
      if(var2 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var4.method30() || this.anInt10706 != var4.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var4.method35();
            this.anInt10707 = var4.method30();
            this.method15768();
         }

         this.anInt10708 |= var3;
         this.anInterface29Array10711[var1] = var4;
         if(this.aBool10710) {
            this.method16600(var1, var4.method81());
         }
      } else {
         this.anInt10708 &= ~var3;
         this.anInterface29Array10711[var1] = null;
         if(this.aBool10710) {
            this.method16600(var1, 0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   boolean method16600(int var1, long var2) {
      return Class23.method813(IDirect3DDevice.SetRenderTarget(this.aClass545_Sub2_Sub1_10705.aLong10294, var1, var2));
   }

   boolean method16601(long var1) {
      return Class23.method813(IDirect3DDevice.SetDepthStencilSurface(this.aClass545_Sub2_Sub1_10705.aLong10294, var1));
   }

   public boolean method14461() {
      return this.anInterface29Array10711[0] != null;
   }

   public int method2745() {
      return this.anInt10706;
   }

   boolean method2748() {
      for(int var1 = 1; var1 < 4; ++var1) {
         Interface29 var2 = this.anInterface29Array10711[var1];
         if(var2 != null) {
            this.method16600(var1, 0L);
         }
      }

      if(this.anInterface41_10704 != null) {
         this.method16601(0L);
      }

      this.aBool10710 = false;
      return true;
   }

   public void method14458(int var1, int var2, int var3, int var4, int var5, int var6, boolean var7, boolean var8) {
      if(var7) {
         long var9 = IDirect3DDevice.GetRenderTarget(this.aClass545_Sub2_Sub1_10705.aLong10294, 0);
         IDirect3DDevice.StretchRect(this.aClass545_Sub2_Sub1_10705.aLong10294, this.anInterface29Array10711[0].method81(), var1, var2, var3, var4, var9, var5, var6, var3, var4, 0);
         IUnknown.Release(var9);
      }

   }

   public void method10() {
      if(this.anInterface41_10704 != null) {
         this.anInterface41_10704.method10();
      }

      for(int var1 = 0; var1 < this.anInterface29Array10711.length; ++var1) {
         if(this.anInterface29Array10711[var1] != null) {
            this.anInterface29Array10711[var1].method10();
         }
      }

   }

   void method16602() {
      if(this.anInterface41_10704 != null) {
         this.anInterface41_10704.method156();
      }

      for(int var1 = 0; var1 < this.anInterface29Array10711.length; ++var1) {
         if(this.anInterface29Array10711[var1] != null) {
            this.anInterface29Array10711[var1].method156();
         }
      }

   }

   public void finalize() throws Throwable {
      this.method16602();
      super.finalize();
   }

   public void method14465(int var1, Interface7 var2) {
      int var3 = 1 << var1;
      Interface29 var4 = (Interface29)var2;
      if(var2 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var4.method30() || this.anInt10706 != var4.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var4.method35();
            this.anInt10707 = var4.method30();
            this.method15768();
         }

         this.anInt10708 |= var3;
         this.anInterface29Array10711[var1] = var4;
         if(this.aBool10710) {
            this.method16600(var1, var4.method81());
         }
      } else {
         this.anInt10708 &= ~var3;
         this.anInterface29Array10711[var1] = null;
         if(this.aBool10710) {
            this.method16600(var1, 0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   public int method2744() {
      return this.anInt10707;
   }

   boolean method16603(long var1) {
      return Class23.method813(IDirect3DDevice.SetDepthStencilSurface(this.aClass545_Sub2_Sub1_10705.aLong10294, var1));
   }

   public int method2746() {
      return this.anInt10706;
   }

   public void method14463(int var1, Interface7 var2) {
      int var3 = 1 << var1;
      Interface29 var4 = (Interface29)var2;
      if(var2 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var4.method30() || this.anInt10706 != var4.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var4.method35();
            this.anInt10707 = var4.method30();
            this.method15768();
         }

         this.anInt10708 |= var3;
         this.anInterface29Array10711[var1] = var4;
         if(this.aBool10710) {
            this.method16600(var1, var4.method81());
         }
      } else {
         this.anInt10708 &= ~var3;
         this.anInterface29Array10711[var1] = null;
         if(this.aBool10710) {
            this.method16600(var1, 0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   public void method14471(int var1, Interface7 var2) {
      int var3 = 1 << var1;
      Interface29 var4 = (Interface29)var2;
      if(var2 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var4.method30() || this.anInt10706 != var4.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var4.method35();
            this.anInt10707 = var4.method30();
            this.method15768();
         }

         this.anInt10708 |= var3;
         this.anInterface29Array10711[var1] = var4;
         if(this.aBool10710) {
            this.method16600(var1, var4.method81());
         }
      } else {
         this.anInt10708 &= ~var3;
         this.anInterface29Array10711[var1] = null;
         if(this.aBool10710) {
            this.method16600(var1, 0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   public int method2747() {
      return this.anInt10707;
   }

   public void method14470(int var1, Interface7 var2) {
      int var3 = 1 << var1;
      Interface29 var4 = (Interface29)var2;
      if(var2 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var4.method30() || this.anInt10706 != var4.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var4.method35();
            this.anInt10707 = var4.method30();
            this.method15768();
         }

         this.anInt10708 |= var3;
         this.anInterface29Array10711[var1] = var4;
         if(this.aBool10710) {
            this.method16600(var1, var4.method81());
         }
      } else {
         this.anInt10708 &= ~var3;
         this.anInterface29Array10711[var1] = null;
         if(this.aBool10710) {
            this.method16600(var1, 0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   boolean method2743() {
      for(int var1 = 1; var1 < 4; ++var1) {
         Interface29 var2 = this.anInterface29Array10711[var1];
         if(var2 != null) {
            this.method16600(var1, 0L);
         }
      }

      if(this.anInterface41_10704 != null) {
         this.method16601(0L);
      }

      this.aBool10710 = false;
      return true;
   }

   public void method14468(Interface8 var1) {
      Interface41 var2 = (Interface41)var1;
      if(var1 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var2.method30() || this.anInt10706 != var2.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var2.method35();
            this.anInt10707 = var2.method30();
            this.method15768();
         }

         this.anInt10708 |= 16;
         this.anInterface41_10704 = var2;
         if(this.aBool10710) {
            this.method16601(var2.method81());
         }
      } else {
         this.anInt10708 &= -17;
         this.anInterface41_10704 = null;
         if(this.aBool10710) {
            this.method16601(0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   public void method14466(Interface8 var1) {
      Interface41 var2 = (Interface41)var1;
      if(var1 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var2.method30() || this.anInt10706 != var2.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var2.method35();
            this.anInt10707 = var2.method30();
            this.method15768();
         }

         this.anInt10708 |= 16;
         this.anInterface41_10704 = var2;
         if(this.aBool10710) {
            this.method16601(var2.method81());
         }
      } else {
         this.anInt10708 &= -17;
         this.anInterface41_10704 = null;
         if(this.aBool10710) {
            this.method16601(0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   public boolean method14469() {
      return this.anInterface29Array10711[0] != null;
   }

   public boolean method14464() {
      return this.anInterface29Array10711[0] != null;
   }

   boolean method149() {
      for(int var1 = 0; var1 < 4; ++var1) {
         Interface29 var2 = this.anInterface29Array10711[var1];
         if(var2 != null) {
            long var3 = var2.method81();
            this.method16600(var1, var3);
         }
      }

      if(this.anInterface41_10704 != null) {
         this.method16601(this.anInterface41_10704.method81());
      }

      this.aBool10710 = true;
      return super.method154();
   }

   void method16604() throws Throwable {
      this.method16602();
      super.finalize();
   }

   public void method148() {
      if(this.anInterface41_10704 != null) {
         this.anInterface41_10704.method10();
      }

      for(int var1 = 0; var1 < this.anInterface29Array10711.length; ++var1) {
         if(this.anInterface29Array10711[var1] != null) {
            this.anInterface29Array10711[var1].method10();
         }
      }

   }

   public void method150() {
      if(this.anInterface41_10704 != null) {
         this.anInterface41_10704.method10();
      }

      for(int var1 = 0; var1 < this.anInterface29Array10711.length; ++var1) {
         if(this.anInterface29Array10711[var1] != null) {
            this.anInterface29Array10711[var1].method10();
         }
      }

   }

   public void method14459(Interface8 var1) {
      Interface41 var2 = (Interface41)var1;
      if(var1 != null) {
         if(this.anInt10708 != 0) {
            if(this.anInt10707 != var2.method30() || this.anInt10706 != var2.method35()) {
               throw new RuntimeException();
            }
         } else {
            this.anInt10706 = var2.method35();
            this.anInt10707 = var2.method30();
            this.method15768();
         }

         this.anInt10708 |= 16;
         this.anInterface41_10704 = var2;
         if(this.aBool10710) {
            this.method16601(var2.method81());
         }
      } else {
         this.anInt10708 &= -17;
         this.anInterface41_10704 = null;
         if(this.aBool10710) {
            this.method16601(0L);
         }

         if(this.anInt10708 == 0) {
            this.anInt10706 = 0;
            this.anInt10707 = 0;
         }
      }

   }

   Class151_Sub1_Sub1_Sub2(Class545_Sub2_Sub1 var1) {
      super(var1);
      this.aClass545_Sub2_Sub1_10705 = var1;
   }

   void method16605() throws Throwable {
      this.method16602();
      super.finalize();
   }

   public int method2741() {
      return this.anInt10707;
   }

   public void method14462(int var1, int var2, int var3, int var4, int var5, int var6, boolean var7, boolean var8) {
      if(var7) {
         long var9 = IDirect3DDevice.GetRenderTarget(this.aClass545_Sub2_Sub1_10705.aLong10294, 0);
         IDirect3DDevice.StretchRect(this.aClass545_Sub2_Sub1_10705.aLong10294, this.anInterface29Array10711[0].method81(), var1, var2, var3, var4, var9, var5, var6, var3, var4, 0);
         IUnknown.Release(var9);
      }

   }

   boolean method16606(int var1, long var2) {
      return Class23.method813(IDirect3DDevice.SetRenderTarget(this.aClass545_Sub2_Sub1_10705.aLong10294, var1, var2));
   }

   boolean method16607(int var1, long var2) {
      return Class23.method813(IDirect3DDevice.SetRenderTarget(this.aClass545_Sub2_Sub1_10705.aLong10294, var1, var2));
   }

   void method16608() throws Throwable {
      this.method16602();
      super.finalize();
   }

   void method16609() {
      if(this.anInterface41_10704 != null) {
         this.anInterface41_10704.method156();
      }

      for(int var1 = 0; var1 < this.anInterface29Array10711.length; ++var1) {
         if(this.anInterface29Array10711[var1] != null) {
            this.anInterface29Array10711[var1].method156();
         }
      }

   }
}
