import jagdx.IDirect3DDevice;
import jagdx.IDirect3DIndexBuffer;
import jagdx.IUnknown;

public class Class380 implements Interface40 {

   long aLong4720 = 0L;
   Class545_Sub2_Sub1 aClass545_Sub2_Sub1_4721;
   int anInt4722;
   boolean aBool4723;
   Class91 aClass91_4724;
   int anInt4725;


   void method6590() {
      if(this.aLong4720 != 0L) {
         this.aClass545_Sub2_Sub1_4721.method15858(this.aLong4720);
         this.aLong4720 = 0L;
      }

      this.anInt4722 = 0;
      this.anInt4725 = 0;
   }

   public int method83() {
      return this.anInt4725;
   }

   public Class91 method236() {
      return this.aClass91_4724;
   }

   public void method232(int var1) {
      this.anInt4725 = this.aClass91_4724.anInt906 * -2107221975 * var1;
      if(this.anInt4725 > this.anInt4722) {
         if(this.aLong4720 != 0L) {
            IUnknown.Release(this.aLong4720);
         }

         int var2 = 8;
         byte var3;
         if(this.aBool4723) {
            var3 = 0;
            var2 |= 512;
         } else {
            var3 = 1;
         }

         this.aLong4720 = IDirect3DDevice.CreateIndexBuffer(this.aClass545_Sub2_Sub1_4721.aLong10294, this.anInt4725, var2, this.aClass91_4724 == Class91.aClass91_899?101:102, var3);
         this.anInt4722 = this.anInt4725;
      }

   }

   public long method214(int var1, int var2) {
      return IDirect3DIndexBuffer.Lock(this.aLong4720, var1, var2, this.aBool4723?8192:0);
   }

   public void method215() {
      IDirect3DIndexBuffer.Unlock(this.aLong4720);
   }

   public boolean method217(int var1, int var2, long var3) {
      return Class23.method813(IDirect3DIndexBuffer.Upload(this.aLong4720, var1, var2, this.aBool4723?8192:0, var3));
   }

   public void method10() {
      if(this.aLong4720 != 0L) {
         IUnknown.Release(this.aLong4720);
         this.aLong4720 = 0L;
      }

      this.anInt4722 = 0;
      this.anInt4725 = 0;
      this.aClass545_Sub2_Sub1_4721.method15169(this);
   }

   public int method31() {
      return this.anInt4725;
   }

   public void finalize() {
      this.method6590();
   }

   public void method8() {
      if(this.aLong4720 != 0L) {
         IUnknown.Release(this.aLong4720);
         this.aLong4720 = 0L;
      }

      this.anInt4722 = 0;
      this.anInt4725 = 0;
      this.aClass545_Sub2_Sub1_4721.method15169(this);
   }

   public Class91 method237() {
      return this.aClass91_4724;
   }

   void method6591() {
      this.method6590();
   }

   void method6592() {
      this.method6590();
   }

   void method6593() {
      this.method6590();
   }

   public int method34() {
      return this.anInt4725;
   }

   public boolean method218(int var1, int var2, long var3) {
      return Class23.method813(IDirect3DIndexBuffer.Upload(this.aLong4720, var1, var2, this.aBool4723?8192:0, var3));
   }

   void method6594() {
      if(this.aLong4720 != 0L) {
         this.aClass545_Sub2_Sub1_4721.method15858(this.aLong4720);
         this.aLong4720 = 0L;
      }

      this.anInt4722 = 0;
      this.anInt4725 = 0;
   }

   public int method29() {
      return this.anInt4725;
   }

   public int method91() {
      return this.anInt4725;
   }

   public boolean method216(int var1, int var2, long var3) {
      return Class23.method813(IDirect3DIndexBuffer.Upload(this.aLong4720, var1, var2, this.aBool4723?8192:0, var3));
   }

   public void method153() {
      IDirect3DIndexBuffer.Unlock(this.aLong4720);
   }

   public void method147() {
      IDirect3DIndexBuffer.Unlock(this.aLong4720);
   }

   public Class91 method234() {
      return this.aClass91_4724;
   }

   public Class91 method235() {
      return this.aClass91_4724;
   }

   public Class91 method233() {
      return this.aClass91_4724;
   }

   Class380(Class545_Sub2_Sub1 var1, Class91 var2, boolean var3) {
      this.aClass545_Sub2_Sub1_4721 = var1;
      this.aClass91_4724 = var2;
      this.aBool4723 = var3;
      this.aClass545_Sub2_Sub1_4721.method15120(this);
   }

   public void method9() {
      if(this.aLong4720 != 0L) {
         IUnknown.Release(this.aLong4720);
         this.aLong4720 = 0L;
      }

      this.anInt4722 = 0;
      this.anInt4725 = 0;
      this.aClass545_Sub2_Sub1_4721.method15169(this);
   }

   public void method231(int var1) {
      this.anInt4725 = this.aClass91_4724.anInt906 * -2107221975 * var1;
      if(this.anInt4725 > this.anInt4722) {
         if(this.aLong4720 != 0L) {
            IUnknown.Release(this.aLong4720);
         }

         int var2 = 8;
         byte var3;
         if(this.aBool4723) {
            var3 = 0;
            var2 |= 512;
         } else {
            var3 = 1;
         }

         this.aLong4720 = IDirect3DDevice.CreateIndexBuffer(this.aClass545_Sub2_Sub1_4721.aLong10294, this.anInt4725, var2, this.aClass91_4724 == Class91.aClass91_899?101:102, var3);
         this.anInt4722 = this.anInt4725;
      }

   }

   public long method219(int var1, int var2) {
      return IDirect3DIndexBuffer.Lock(this.aLong4720, var1, var2, this.aBool4723?8192:0);
   }
}
