import jagdx.IDirect3DDevice;
import jagdx.IDirect3DVertexBuffer;
import jagdx.IUnknown;

public class Class319 implements Interface35 {

   int anInt4005;
   int anInt4006;
   byte aByte4007;
   boolean aBool4008;
   Class545_Sub2_Sub1 aClass545_Sub2_Sub1_4009;
   long aLong4010 = 0L;


   public boolean method220(int var1, int var2) {
      this.anInt4005 = var1;
      this.aByte4007 = (byte)var2;
      if(this.anInt4005 > this.anInt4006) {
         int var3 = 8;
         byte var4;
         if(this.aBool4008) {
            var4 = 0;
            var3 |= 512;
         } else {
            var4 = 1;
         }

         if(this.aLong4010 != 0L) {
            IUnknown.Release(this.aLong4010);
         }

         this.aLong4010 = IDirect3DDevice.CreateVertexBuffer(this.aClass545_Sub2_Sub1_4009.aLong10294, this.anInt4005, var3, 0, var4);
         this.anInt4006 = this.anInt4005;
      }

      return this.aLong4010 != 0L;
   }

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

   int method5760() {
      return this.aByte4007;
   }

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

   public long method214(int var1, int var2) {
      return IDirect3DVertexBuffer.Lock(this.aLong4010, var1, var2, this.aBool4008?8192:0);
   }

   public boolean method221(int var1, int var2) {
      this.anInt4005 = var1;
      this.aByte4007 = (byte)var2;
      if(this.anInt4005 > this.anInt4006) {
         int var3 = 8;
         byte var4;
         if(this.aBool4008) {
            var4 = 0;
            var3 |= 512;
         } else {
            var4 = 1;
         }

         if(this.aLong4010 != 0L) {
            IUnknown.Release(this.aLong4010);
         }

         this.aLong4010 = IDirect3DDevice.CreateVertexBuffer(this.aClass545_Sub2_Sub1_4009.aLong10294, this.anInt4005, var3, 0, var4);
         this.anInt4006 = this.anInt4005;
      }

      return this.aLong4010 != 0L;
   }

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

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

      this.anInt4006 = 0;
      this.anInt4005 = 0;
      this.aClass545_Sub2_Sub1_4009.method15169(this);
   }

   void method5761() {
      if(this.aLong4010 != 0L) {
         this.aClass545_Sub2_Sub1_4009.method15858(this.aLong4010);
         this.aLong4010 = 0L;
         this.anInt4006 = 0;
         this.anInt4005 = 0;
      }

   }

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

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

      this.anInt4006 = 0;
      this.anInt4005 = 0;
      this.aClass545_Sub2_Sub1_4009.method15169(this);
   }

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

      this.anInt4006 = 0;
      this.anInt4005 = 0;
      this.aClass545_Sub2_Sub1_4009.method15169(this);
   }

   void method5762() {
      this.method5761();
   }

   public long method219(int var1, int var2) {
      return IDirect3DVertexBuffer.Lock(this.aLong4010, var1, var2, this.aBool4008?8192:0);
   }

   void method5763() {
      this.method5761();
   }

   Class319(Class545_Sub2_Sub1 var1, boolean var2) {
      this.aClass545_Sub2_Sub1_4009 = var1;
      this.aBool4008 = var2;
      this.aClass545_Sub2_Sub1_4009.method15120(this);
   }

   public void method147() {
      IDirect3DVertexBuffer.Unlock(this.aLong4010);
   }

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

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

   public void method215() {
      IDirect3DVertexBuffer.Unlock(this.aLong4010);
   }

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

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

   public void method153() {
      IDirect3DVertexBuffer.Unlock(this.aLong4010);
   }

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

   int method5764() {
      return this.aByte4007;
   }

   int method5765() {
      return this.aByte4007;
   }

   void method5766() {
      if(this.aLong4010 != 0L) {
         this.aClass545_Sub2_Sub1_4009.method15858(this.aLong4010);
         this.aLong4010 = 0L;
         this.anInt4006 = 0;
         this.anInt4005 = 0;
      }

   }

   void method5767() {
      this.method5761();
   }

   int method5768() {
      return this.aByte4007;
   }
}
