import jagdx.D3DADAPTER_IDENTIFIER;
import jagdx.D3DCAPS;
import jagdx.D3DDISPLAYMODE;
import jagdx.D3DLIGHT;
import jagdx.D3DPRESENT_PARAMETERS;
import jagdx.IDirect3D;
import jagdx.IDirect3DDevice;
import jagdx.IDirect3DEventQuery;
import jagdx.IDirect3DSurface;
import jagdx.IUnknown;
import java.awt.Canvas;

public class Class545_Sub2_Sub1 extends Class545_Sub2 {

   int anInt10291;
   int anInt10292;
   long aLong10293 = 0L;
   long aLong10294 = 0L;
   D3DPRESENT_PARAMETERS aD3DPRESENT_PARAMETERS10295;
   Class456 aClass456_10296 = new Class456();
   int anInt10297 = 0;
   long aLong10298 = 0L;
   long aLong10299 = 0L;
   long aLong10300 = 0L;
   boolean aBool10301 = false;
   boolean[] aBoolArray10302;
   boolean aBool10303;
   boolean[] aBoolArray10304;
   boolean[] aBoolArray10305;
   Class353[] aClass353Array10306;
   int[] anIntArray10307;
   static int[] anIntArray10308 = new int[]{77, 80};
   Class100_Sub1 aClass100_Sub1_10309;
   long aLong10310;
   D3DCAPS aD3DCAPS10311;
   boolean[] aBoolArray10312;
   boolean aBool10313;
   float[] aFloatArray10314 = new float[16];
   boolean aBool10315;
   boolean aBool10316;
   int anInt10317 = 128;
   int anInt10318 = 0;
   long[] aLongArray10319;
   Class317 aClass317_10320;
   static int[] anIntArray10321 = new int[]{22, 23};


   static boolean method15842(int var0, int var1, long var2, int var4, D3DPRESENT_PARAMETERS var5) {
      int var6 = 0;
      int var7 = 0;
      int var8 = 0;

      try {
         D3DDISPLAYMODE var9 = new D3DDISPLAYMODE();
         if(Class23.method812(IDirect3D.GetAdapterDisplayMode(var2, var0, var9))) {
            return false;
         } else {
            label71:
            for(; var4 >= 0; --var4) {
               if(var4 != 1) {
                  var8 = 0 + var4;

                  for(int var10 = 0; var10 < anIntArray10321.length; ++var10) {
                     if(IDirect3D.CheckDeviceType(var2, var0, var1, var9.Format, anIntArray10321[var10], true) == 0 && IDirect3D.CheckDeviceFormat(var2, var0, var1, var9.Format, 1, 1, anIntArray10321[var10]) == 0 && (var4 == 0 || IDirect3D.CheckDeviceMultiSampleType(var2, var0, var1, anIntArray10321[var10], true, var8) == 0)) {
                        for(int var11 = 0; var11 < anIntArray10308.length; ++var11) {
                           if(IDirect3D.CheckDeviceFormat(var2, var0, var1, var9.Format, 2, 1, anIntArray10308[var11]) == 0 && IDirect3D.CheckDepthStencilMatch(var2, var0, var1, var9.Format, anIntArray10321[var10], anIntArray10308[var11]) == 0 && (var4 == 0 || IDirect3D.CheckDeviceMultiSampleType(var2, var0, var1, anIntArray10308[var10], true, var8) == 0)) {
                              var7 = anIntArray10321[var10];
                              var6 = anIntArray10308[var11];
                              break label71;
                           }
                        }
                     }
                  }
               }
            }

            if(var4 >= 0 && var7 != 0 && var6 != 0) {
               var5.BackBufferFormat = var7;
               var5.AutoDepthStencilFormat = var6;
               var5.MultiSampleType = var8;
               var5.MultiSampleQuality = 0;
               return true;
            } else {
               return false;
            }
         }
      } catch (Throwable var12) {
         return false;
      }
   }

   public boolean method14968() {
      return (this.aD3DCAPS10311.PixelShaderVersion & '\uffff') >= 257;
   }

   static Class545 method15843(Canvas var0, Interface24 var1, Class253 var2, Integer var3) {
      Class545_Sub2_Sub1 var4 = null;
      byte var5 = 0;
      byte var6 = 1;
      long var7 = IDirect3D.Direct3DCreate();
      D3DCAPS var9 = new D3DCAPS();
      IDirect3D.GetDeviceCaps(var7, var5, var6, var9);
      if(var9.MaxSimultaneousTextures < 2) {
         throw new RuntimeException("");
      } else if((var9.TextureOpCaps & 2) == 0) {
         throw new RuntimeException("");
      } else if((var9.TextureOpCaps & 8) == 0) {
         throw new RuntimeException("");
      } else if((var9.TextureOpCaps & 64) == 0) {
         throw new RuntimeException("");
      } else if((var9.TextureOpCaps & 512) == 0) {
         throw new RuntimeException("");
      } else if((var9.TextureOpCaps & 33554432) == 0) {
         throw new RuntimeException("");
      } else if((var9.SrcBlendCaps & var9.DestBlendCaps & 16) == 0) {
         throw new RuntimeException("");
      } else if((var9.SrcBlendCaps & var9.DestBlendCaps & 32) == 0) {
         throw new RuntimeException("");
      } else if((var9.SrcBlendCaps & var9.DestBlendCaps & 2) == 0) {
         throw new RuntimeException("");
      } else if(var9.MaxActiveLights > 0 && var9.MaxActiveLights < 2) {
         throw new RuntimeException("");
      } else if(var9.MaxStreams < 5) {
         throw new RuntimeException("");
      } else {
         D3DPRESENT_PARAMETERS var10 = new D3DPRESENT_PARAMETERS(var0);
         var10.Windowed = true;
         var10.EnableAutoDepthStencil = true;
         var10.BackBufferWidth = var0.getWidth();
         var10.BackBufferHeight = var0.getHeight();
         var10.BackBufferCount = 1;
         var10.PresentationInterval = Integer.MIN_VALUE;
         if(!method15867(var5, var6, var7, var3.intValue(), var10)) {
            throw new RuntimeException("");
         } else {
            int var11 = 0;
            if((var9.DevCaps & 1048576) != 0) {
               var11 |= 16;
            }

            long var12 = 0L;

            try {
               var12 = IDirect3D.CreateDeviceContext(var7, var5, var6, var0, var11 | 64, var10);
            } catch (RuntimeException_Sub1 var15) {
               var12 = IDirect3D.CreateDeviceContext(var7, var5, var6, var0, var11 & -1048577 | 32, var10);
            }

            var4 = new Class545_Sub2_Sub1(var5, var6, var7, var12, var10, var9, var1, var2, var3.intValue());
            if(!var4.aHashtable7368.containsKey(var0)) {
               Class193.method3356(var0, -448881775);
               var4.method11448(var0, new Class151_Sub2_Sub2_Sub2(var4, var0, var0.getWidth(), var0.getHeight(), true), 217499732);
            }

            var4.method11449(var0, (byte)99);
            var4.method14972();
            return var4;
         }
      }
   }

   Class545_Sub2_Sub1(int var1, int var2, long var3, long var5, D3DPRESENT_PARAMETERS var7, D3DCAPS var8, Interface24 var9, Class253 var10, int var11) {
      super(var9, var10, var11, 0);
      this.aLongArray10319 = new long[this.anInt10317];

      try {
         this.anInt10291 = var1;
         this.anInt10292 = var2;
         this.aLong10293 = var3;
         this.aLong10294 = var5;
         this.aD3DPRESENT_PARAMETERS10295 = var7;
         this.aD3DCAPS10311 = var8;
         this.aLong10298 = D3DLIGHT.Create();
         this.aLong10299 = D3DLIGHT.Create();
         this.aLong10300 = D3DLIGHT.Create();
         this.anInt9764 = this.aD3DCAPS10311.MaxSimultaneousTextures;
         this.anInt9636 = this.aD3DCAPS10311.MaxActiveLights > 0?this.aD3DCAPS10311.MaxActiveLights:8;
         this.aBool10303 = (this.aD3DCAPS10311.TextureCaps & 2) == 0;
         this.aBool9769 = (this.aD3DCAPS10311.TextureCaps & 8192) != 0;
         this.aBool10313 = (this.aD3DCAPS10311.TextureCaps & 65536) != 0;
         this.aBool10316 = (this.aD3DCAPS10311.TextureCaps & 16384) != 0;
         this.aBool9765 = this.aD3DCAPS10311.NumSimultaneousRTs > 0;
         this.aBool9694 = this.aD3DCAPS10311.NumSimultaneousRTs > 0;
         this.aBool9768 = this.anInt9757 > 0 || IDirect3D.CheckDeviceMultiSampleType(this.aLong10293, this.anInt10291, this.anInt10292, this.aD3DPRESENT_PARAMETERS10295.BackBufferFormat, true, 2) == 0;
         this.aBool9767 = this.aD3DCAPS10311.NumSimultaneousRTs > 0 && this.anInt9757 > 0 || IDirect3D.CheckDeviceMultiSampleType(this.aLong10293, this.anInt10291, this.anInt10292, 113, true, 2) == 0;
         this.aBoolArray10302 = new boolean[this.anInt9764];
         this.aBoolArray10312 = new boolean[this.anInt9764];
         this.aBoolArray10304 = new boolean[this.anInt9764];
         this.aClass353Array10306 = new Class353[this.anInt9764];
         this.aBoolArray10305 = new boolean[this.anInt9764];
         this.anIntArray10307 = new int[this.anInt9764];
         Class328 var12 = new Class328();
         var12.method6019(1.0F, -1.0F, 0.5F);
         var12.method6005(0.0F, 0.0F, 0.5F);
         this.aClass317_10320 = new Class317();
         this.aClass317_10320.method5613(var12);
         IDirect3DDevice.BeginScene(this.aLong10294);
      } catch (Throwable var13) {
         var13.printStackTrace();
         this.method11431(1084016950);
         throw new RuntimeException("");
      }
   }

   void method14977() {
      for(ObjectVar var1 = (ObjectVar)this.aClass456_10296.method7682((byte)21); var1 != null; var1 = (ObjectVar)this.aClass456_10296.method7666(-124135230)) {
         Interface28 var2 = (Interface28)var1.object;
         var2.method151();
         if(var2 == this.aClass151_7359) {
            var2.method154();
         }
      }

      super.method14977();
   }

   void method15185() {
      for(ObjectVar var1 = (ObjectVar)this.aClass456_10296.method7682((byte)112); var1 != null; var1 = (ObjectVar)this.aClass456_10296.method7666(-885184342)) {
         Interface28 var2 = (Interface28)var1.object;
         var2.method10();
      }

      super.method15185();
   }

   void method15064() {}

   void method15112() {
      for(int var1 = 0; var1 < this.anInt9764; ++var1) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 7, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 6, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 5, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 1, 1);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 2, 1);
         this.aClass353Array10306[var1] = Class353.aClass353_4462;
         boolean[] var2 = this.aBoolArray10302;
         this.aBoolArray10312[var1] = true;
         var2[var1] = true;
         this.aBoolArray10305[var1] = false;
         this.anIntArray10307[var1] = 0;
      }

      IDirect3DDevice.SetTextureStageState(this.aLong10294, 0, 6, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 9, 2);
      IDirect3DDevice.SetRenderState(this.aLong10294, 23, 4);
      IDirect3DDevice.SetRenderState(this.aLong10294, 25, 5);
      IDirect3DDevice.SetRenderState(this.aLong10294, 24, 0);
      IDirect3DDevice.SetRenderState(this.aLong10294, 22, 2);
      IDirect3DDevice.SetRenderState(this.aLong10294, 147, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 145, 1);
      IDirect3DDevice.method14452(this.aLong10294, 38, 0.95F);
      IDirect3DDevice.SetRenderState(this.aLong10294, 35, 3);
      IDirect3DDevice.method14452(this.aLong10294, 154, 1.0F);
      D3DLIGHT.SetType(this.aLong10298, 3);
      D3DLIGHT.SetType(this.aLong10299, 3);
      D3DLIGHT.SetType(this.aLong10300, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 206, 1);
      this.aBool10301 = false;
      super.method15112();
   }

   void method15844(Interface28 var1) {
      if(this.method15845(var1) == null) {
         this.aClass456_10296.method7712(new ObjectVar(var1), (byte)89);
      }

   }

   void method11429(int var1, int var2) throws Exception_Sub5 {
      IDirect3DDevice.EndScene(this.aLong10294);
      int var3 = this.aClass151_Sub2_7358.method14944();
      if(Class23.method812(var3)) {
         if(var3 != -2005530520) {
            if(++this.anInt10297 > 50) {
               throw new Exception_Sub5(var3);
            }
         } else {
            this.aClass151_Sub2_7358.method10();
            this.method15860();
            ((Class151_Sub2_Sub2_Sub2)this.aClass151_Sub2_7358).method151();
         }
      } else {
         this.anInt10297 = 0;
      }

      IDirect3DDevice.BeginScene(this.aLong10294);
      if(this.anInterface24_7370 != null) {
         this.anInterface24_7370.method117((byte)21);
      }

   }

   public void method11430() {
      long var1 = IDirect3DDevice.CreateEventQuery(this.aLong10294);
      if(Class23.method813(IDirect3DEventQuery.Issue(var1))) {
         while(true) {
            int var3 = IDirect3DEventQuery.IsSignaled(var1);
            if(var3 != 1) {
               break;
            }

            Thread.yield();
         }
      }

      IUnknown.Release(var1);
   }

   void method15132() {
      switch(this.aClass57_9674.anInt532) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 5);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 6);
         break;
      case 3:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 9);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
      }

      switch(this.anInt9742) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 1);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 2);
      }

   }

   void method11651() {
      super.finalize();
   }

   Class341 method15299(Class348[] var1) {
      return new Class341_Sub1(this, var1);
   }

   Interface33 method15246(int var1, int var2, boolean var3, int[] var4, int var5, int var6) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6);
   }

   void method15328() {
      int var1;
      for(var1 = 0; var1 < this.anInt9709; ++var1) {
         Class225_Sub40 var2 = this.aClass225_Sub40Array9719[var1];
         int var3 = var1 + 2;
         int var4 = var2.method14107(-1638065097);
         float var5 = var2.method14110(94894674) / 255.0F;
         D3DLIGHT.SetPosition(this.aLong10300, (float)var2.method14103(-1259791775), (float)var2.method14104(-1249050011), (float)var2.method14105((byte)120));
         D3DLIGHT.SetDiffuse(this.aLong10300, (float)(var4 >> 16 & 255) * var5, (float)(var4 >> 8 & 255) * var5, (float)(var4 & 255) * var5, 0.0F);
         D3DLIGHT.SetAttenuation(this.aLong10300, 0.0F, 0.0F, 1.0F / (float)(var2.method14113(1611982691) * var2.method14113(2098528020)));
         D3DLIGHT.SetRange(this.aLong10300, (float)var2.method14113(964545889));
         IDirect3DDevice.SetLight(this.aLong10294, var3, this.aLong10300);
         IDirect3DDevice.LightEnable(this.aLong10294, var3, true);
      }

      while(var1 < this.anInt9708) {
         IDirect3DDevice.LightEnable(this.aLong10294, var1 + 2, false);
         ++var1;
      }

   }

   final void method15147(int var1, Class351 var2, boolean var3) {
      if(this.aBool9681) {
         int var4 = 0;
         byte var5;
         switch(var1) {
         case 1:
            var5 = 6;
            break;
         case 2:
            var5 = 27;
            break;
         default:
            var5 = 5;
         }

         if(var3) {
            var4 |= 16;
         }

         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, var5, method15872(var2) | var4);
      }

   }

   public Interface8 method11456(int var1, int var2) {
      return new Class320(this, Class91.aClass91_901, var1, var2, 0);
   }

   public Interface8 method11457(int var1, int var2, int var3) {
      return new Class320(this, Class91.aClass91_901, var1, var2, var3);
   }

   ObjectVar method15845(Interface28 var1) {
      for(ObjectVar var2 = (ObjectVar)this.aClass456_10296.method7682((byte)102); var2 != null; var2 = (ObjectVar)this.aClass456_10296.method7666(-453032236)) {
         if(var2.object == var1) {
            return var2;
         }
      }

      return null;
   }

   boolean method15846() {
      int var1 = IDirect3DDevice.TestCooperativeLevel(this.aLong10294);
      if(var1 == 0 || var1 == -2005530519) {
         IDirect3DDevice.SetDepthStencilSurface(this.aLong10294, 0L);

         int var2;
         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetRenderTarget(this.aLong10294, var2, 0L);
         }

         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetStreamSource(this.aLong10294, var2, 0L, 0, 0);
         }

         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetTexture(this.aLong10294, var2, 0L);
         }

         IDirect3DDevice.SetIndices(this.aLong10294, 0L);
         this.method15185();
         this.aD3DPRESENT_PARAMETERS10295.BackBufferWidth = 0;
         this.aD3DPRESENT_PARAMETERS10295.BackBufferHeight = 0;
         if(method15867(this.anInt10291, this.anInt10292, this.aLong10293, this.anInt9757, this.aD3DPRESENT_PARAMETERS10295)) {
            var2 = IDirect3DDevice.Reset(this.aLong10294, this.aD3DPRESENT_PARAMETERS10295);
            if(Class23.method813(var2)) {
               this.method14977();
               this.method15112();
               return true;
            }

            System.exit(0);
         }
      }

      return false;
   }

   void method15847(Interface28 var1) {
      ObjectVar var2 = this.method15845(var1);
      if(var2 != null) {
         var2.method3857(961619643);
      }

   }

   public int[] ay(int var1, int var2, int var3, int var4) {
      int[] var5 = null;
      long var6 = IDirect3DDevice.GetRenderTarget(this.aLong10294, 0);
      long var8 = IDirect3DDevice.CreateRenderTarget(this.aLong10294, var3, var4, 21, 0, 0, true);
      if(Class23.method813(IDirect3DDevice.StretchRect(this.aLong10294, var6, var1, var2, var3, var4, var8, 0, 0, var3, var4, 1))) {
         var5 = new int[var3 * var4];
         IDirect3DSurface.Download(var8, 0, 0, var3, var4, var3 * 4, 16, this.aLong9730);
         this.aByteBuffer9763.clear();
         this.aByteBuffer9763.asIntBuffer().get(var5);
      }

      IUnknown.Release(var6);
      IUnknown.Release(var8);
      return var5;
   }

   public void method11458() {}

   public Class151_Sub1 method11657() {
      return new Class151_Sub1_Sub1_Sub2(this);
   }

   void method15079(Interface40 var1) {
      IDirect3DDevice.SetIndices(this.aLong10294, ((Class380)var1).aLong4720);
   }

   void method15291() {
      if(this.aClass151_7359 != null) {
         IDirect3DDevice.SetViewport(this.aLong10294, this.anInt9688 + this.anInt9619, this.anInt9689 + this.anInt9643, this.anInt9686, this.anInt9753, this.aFloat9670, this.aFloat9671);
      }

   }

   static final int method15848(Class351 var0) {
      switch(var0.anInt4459) {
      case 0:
         return 1;
      case 1:
         return 2;
      case 2:
         return 3;
      case 3:
         return 0;
      default:
         throw new IllegalArgumentException();
      }
   }

   void method15101() {
      IDirect3DDevice.method14453(this.aLong10294, 174, this.aBool9783);
   }

   final void method15849(long var1) {
      this.aLong10310 = var1;
      IDirect3DDevice.SetVertexShader(this.aLong10294, var1);
   }

   final void method15850(long var1) {
      IDirect3DDevice.SetPixelShader(this.aLong10294, var1);
   }

   public void method14965(Class317 var1, Class317 var2, Class317 var3) {
      IDirect3DDevice.SetTransform(this.aLong10294, 256, var1.aFloatArray4000);
      IDirect3DDevice.SetTransform(this.aLong10294, 2, var2.aFloatArray4000);
      IDirect3DDevice.SetTransform(this.aLong10294, 3, var3.aFloatArray4000);
   }

   public void method15013(Class317 var1) {
      var1.method5612(this.aClass317_10320);
   }

   void method15223() {
      IDirect3DDevice.method14453(this.aLong10294, 7, this.aBool9616);
   }

   void method15025() {
      IDirect3DDevice.method14453(this.aLong10294, 14, this.aBool9713 && this.aBool9691);
   }

   void method15030() {
      if(this.aBool9681) {
         IDirect3DDevice.method14453(this.aLong10294, 137, this.aBool9685 && !this.aBool9630);
      }

   }

   void method15031() {
      if(this.aBool9681) {
         D3DLIGHT.SetAmbient(this.aLong10298, this.aFloat9701 * this.aFloat9760, this.aFloat9702 * this.aFloat9760, this.aFloat9703 * this.aFloat9760, 0.0F);
         this.aBool10301 = false;
      }

   }

   void method15032() {
      if(this.aBool9681) {
         float var1 = this.aBool9733?this.aFloat9705:0.0F;
         float var2 = this.aBool9733?-this.aFloat9706:0.0F;
         D3DLIGHT.SetDiffuse(this.aLong10298, var1 * this.aFloat9701, var1 * this.aFloat9702, var1 * this.aFloat9703, 0.0F);
         D3DLIGHT.SetDiffuse(this.aLong10299, var2 * this.aFloat9701, var2 * this.aFloat9702, var2 * this.aFloat9703, 0.0F);
         this.aBool10301 = false;
      }

   }

   public Class151_Sub1 method11656() {
      return new Class151_Sub1_Sub1_Sub2(this);
   }

   void method15035() {
      this.method15032();
      this.method15034();
   }

   void method15034() {
      if(this.aBool9681 && !this.aBool10301) {
         IDirect3DDevice.LightEnable(this.aLong10294, 0, false);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, false);
         IDirect3DDevice.SetLight(this.aLong10294, 0, this.aLong10298);
         IDirect3DDevice.SetLight(this.aLong10294, 1, this.aLong10299);
         IDirect3DDevice.LightEnable(this.aLong10294, 0, true);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, true);
         this.aBool10301 = true;
      }

   }

   public boolean method15144() {
      return (this.aD3DCAPS10311.VertexShaderVersion & '\uffff') >= 257;
   }

   boolean method15038(Class98 var1, Class91 var2) {
      D3DDISPLAYMODE var3 = new D3DDISPLAYMODE();
      return Class23.method813(IDirect3D.GetAdapterDisplayMode(this.aLong10293, this.anInt10291, var3)) && Class23.method813(IDirect3D.CheckDeviceFormat(this.aLong10293, this.anInt10291, this.anInt10292, var3.Format, 0, 3, method15855(var1, var2)));
   }

   void method15004() {
      if(this.aBool9681 && !this.aBool10301) {
         IDirect3DDevice.LightEnable(this.aLong10294, 0, false);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, false);
         IDirect3DDevice.SetLight(this.aLong10294, 0, this.aLong10298);
         IDirect3DDevice.SetLight(this.aLong10294, 1, this.aLong10299);
         IDirect3DDevice.LightEnable(this.aLong10294, 0, true);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, true);
         this.aBool10301 = true;
      }

   }

   void method15327() {
      for(ObjectVar var1 = (ObjectVar)this.aClass456_10296.method7682((byte)32); var1 != null; var1 = (ObjectVar)this.aClass456_10296.method7666(-370256688)) {
         Interface28 var2 = (Interface28)var1.object;
         var2.method151();
         if(var2 == this.aClass151_7359) {
            var2.method154();
         }
      }

      super.method14977();
   }

   Interface33 method15081(int var1, int var2, boolean var3, int[] var4, int var5, int var6) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6);
   }

   Interface33 method15231(Class98 var1, int var2, int var3, boolean var4, byte[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   Interface33 method15060(Class98 var1, int var2, int var3, boolean var4, float[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   void method15134() {
      for(int var1 = 0; var1 < this.anInt9764; ++var1) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 7, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 6, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 5, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 1, 1);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 2, 1);
         this.aClass353Array10306[var1] = Class353.aClass353_4462;
         boolean[] var2 = this.aBoolArray10302;
         this.aBoolArray10312[var1] = true;
         var2[var1] = true;
         this.aBoolArray10305[var1] = false;
         this.anIntArray10307[var1] = 0;
      }

      IDirect3DDevice.SetTextureStageState(this.aLong10294, 0, 6, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 9, 2);
      IDirect3DDevice.SetRenderState(this.aLong10294, 23, 4);
      IDirect3DDevice.SetRenderState(this.aLong10294, 25, 5);
      IDirect3DDevice.SetRenderState(this.aLong10294, 24, 0);
      IDirect3DDevice.SetRenderState(this.aLong10294, 22, 2);
      IDirect3DDevice.SetRenderState(this.aLong10294, 147, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 145, 1);
      IDirect3DDevice.method14452(this.aLong10294, 38, 0.95F);
      IDirect3DDevice.SetRenderState(this.aLong10294, 35, 3);
      IDirect3DDevice.method14452(this.aLong10294, 154, 1.0F);
      D3DLIGHT.SetType(this.aLong10298, 3);
      D3DLIGHT.SetType(this.aLong10299, 3);
      D3DLIGHT.SetType(this.aLong10300, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 206, 1);
      this.aBool10301 = false;
      super.method15112();
   }

   Interface37 method15046(int var1, boolean var2, int[][] var3) {
      return new Class329_Sub3(this, var1, var2, var3);
   }

   void method15325(int var1) {
      if(!this.aBool10315) {
         int var2 = (var1 & 2) != 0?2:3;
         IDirect3DDevice.SetRenderState(this.aLong10294, 8, var2);
      }

   }

   final void method15851(Class329 var1) {
      IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, var1.method6066());
      if(this.aBool9681 && !this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = true;
         this.method15083();
         this.method15126();
      }

   }

   public Class79 method11517(Class79 var1, Class79 var2, float var3, Class79 var4) {
      return var3 < 0.5F?var1:var2;
   }

   void method15183() {
      IDirect3DDevice.SetScissorRect(this.aLong10294, this.anInt9688 + this.anInt9678, this.anInt9689 + this.anInt9735, this.anInt9679, this.anInt9745);
   }

   public void method15052() {
      if(this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = false;
         IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, 0L);
         this.method15083();
         this.method15126();
      }

   }

   void method15063() {
      if(this.aLong10310 == 0L && this.aClass368Array9717[this.anInt9625] != Class368.aClass368_4615) {
         if(this.aClass368Array9717[this.anInt9625] == Class368.aClass368_4619) {
            IDirect3DDevice.SetTransform(this.aLong10294, 16 + this.anInt9625, this.aClass317Array9716[this.anInt9625].method5642(this.aFloatArray10314));
         } else {
            IDirect3DDevice.SetTransform(this.aLong10294, 16 + this.anInt9625, this.aClass317Array9716[this.anInt9625].method5636(this.aFloatArray10314));
         }

         int var1 = method15862(this.aClass368Array9717[this.anInt9625]);
         if(var1 != this.anIntArray10307[this.anInt9625]) {
            IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 24, var1);
            this.anIntArray10307[this.anInt9625] = var1;
         }
      } else {
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 24, 0);
         this.anIntArray10307[this.anInt9625] = 0;
      }

   }

   public void method15209(Class317 var1) {
      var1.method5612(this.aClass317_10320);
   }

   void method15126() {
      if(this.aBool9681) {
         int var1 = this.aBoolArray10304[this.anInt9625]?method15853(this.aClass367Array9718[this.anInt9625]):1;
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 1, var1);
      }

   }

   void method15157() {
      for(ObjectVar var1 = (ObjectVar)this.aClass456_10296.method7682((byte)54); var1 != null; var1 = (ObjectVar)this.aClass456_10296.method7666(-481137096)) {
         Interface28 var2 = (Interface28)var1.object;
         var2.method10();
      }

      super.method15185();
   }

   static final int method15852(Class368 var0) {
      switch(var0.anInt4621) {
      case 0:
         return 1;
      case 1:
         return 256;
      case 2:
         return 2;
      case 3:
      default:
         return 0;
      case 4:
         return 3;
      case 5:
         return 4;
      }
   }

   final void method15058(int var1, Class351 var2, boolean var3) {
      if(this.aBool9681) {
         int var4 = 0;
         byte var5;
         switch(var1) {
         case 1:
            var5 = 6;
            break;
         case 2:
            var5 = 27;
            break;
         default:
            var5 = 5;
         }

         if(var3) {
            var4 |= 16;
         }

         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, var5, method15872(var2) | var4);
      }

   }

   final void method15062() {
      if(this.aBool9681) {
         IDirect3DDevice.SetRenderState(this.aLong10294, 60, this.anInt9720);
      }

   }

   static final int method15853(Class367 var0) {
      switch(var0.anInt4614) {
      case 0:
         return 2;
      case 1:
         return 26;
      case 2:
         return 4;
      case 3:
         return 7;
      case 4:
         return 10;
      default:
         throw new IllegalArgumentException();
      }
   }

   void method15024() {
      IDirect3DDevice.method14453(this.aLong10294, 7, this.aBool9616);
   }

   public void method15305(int var1, Interface35 var2) {
      Class319 var3 = (Class319)var2;
      IDirect3DDevice.SetStreamSource(this.aLong10294, var1, var3.aLong4010, 0, var3.method5760());
   }

   void method15143(int var1) {
      IDirect3DDevice.SetRenderState(this.aLong10294, 168, var1);
   }

   public void ba(int var1, int var2) {
      IDirect3DDevice.Clear(this.aLong10294, var1, var2, 1.0F, 0);
   }

   Interface33 method15243(Class98 var1, int var2, int var3, boolean var4, byte[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   void method15070() {
      IDirect3DDevice.method14453(this.aLong10294, 27, this.aBool9755);
   }

   void method15259() {
      if(this.aBool9681) {
         IDirect3DDevice.method14453(this.aLong10294, 28, this.aBool9749 && this.aBool9746 && this.anInt9623 >= 0);
      }

   }

   void method15072() {
      this.aFloat9752 = this.aFloat9675 - (float)this.anInt9750;
      this.aFloat9751 = this.aFloat9752 - (float)this.anInt9623;
      if(this.aFloat9751 < this.aFloat9696) {
         this.aFloat9751 = this.aFloat9696;
      }

      if(this.aBool9681) {
         IDirect3DDevice.method14452(this.aLong10294, 36, this.aFloat9751);
         IDirect3DDevice.method14452(this.aLong10294, 37, this.aFloat9752);
         IDirect3DDevice.SetRenderState(this.aLong10294, 34, this.anInt9748);
      }

   }

   final void method15854(Class329_Sub1 var1) {
      this.method15851(var1);
      if(!this.aBoolArray10302[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, 1);
         this.aBoolArray10302[this.anInt9625] = true;
      }

      if(!this.aBoolArray10312[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, 1);
         this.aBoolArray10312[this.anInt9625] = true;
      }

   }

   final Interface40 method15075(boolean var1) {
      return new Class380(this, Class91.aClass91_899, var1);
   }

   final Interface35 method15237(boolean var1) {
      return new Class319(this, var1);
   }

   Class341 method15076(Class348[] var1) {
      return new Class341_Sub1(this, var1);
   }

   public void method14991(Class341 var1) {
      Class341_Sub1 var2 = (Class341_Sub1)var1;
      IDirect3DDevice.SetVertexDeclaration(this.aLong10294, var2.aLong8150);
   }

   public void method15078(int var1, Interface35 var2) {
      Class319 var3 = (Class319)var2;
      IDirect3DDevice.SetStreamSource(this.aLong10294, var1, var3.aLong4010, 0, var3.method5760());
   }

   public Class151_Sub1 method11653() {
      return new Class151_Sub1_Sub1_Sub2(this);
   }

   public final void method14993(Class374 var1, int var2, int var3) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawPrimitive(this.aLong10294, method15857(var1), var2, var3);
   }

   boolean method15039(Class98 var1, Class91 var2) {
      D3DDISPLAYMODE var3 = new D3DDISPLAYMODE();
      return Class23.method813(IDirect3D.GetAdapterDisplayMode(this.aLong10293, this.anInt10291, var3)) && Class23.method813(IDirect3D.CheckDeviceFormat(this.aLong10293, this.anInt10291, this.anInt10292, var3.Format, 0, 4, method15855(var1, var2)));
   }

   public final void method15086(Class374 var1, int var2, int var3, int var4, int var5) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawIndexedPrimitive(this.aLong10294, method15857(var1), 0, var2, var3, var4, var5);
   }

   Interface36 method15021(Class98 var1, Class91 var2, int var3, int var4) {
      return new Class329_Sub2_Sub1(this, var1, var2, var3, var4);
   }

   public Class103 method15316(String var1) {
      byte[] var2 = this.method15870(var1);
      if(var2 == null) {
         return null;
      } else {
         Class28 var3 = this.method14970(var2);
         return new Class103_Sub2(this, var3);
      }
   }

   void method15285() {
      IDirect3DDevice.method14453(this.aLong10294, 27, this.aBool9755);
   }

   static final int method15855(Class98 var0, Class91 var1) {
      switch(var1.anInt905 * -1560869161) {
      case 2:
         switch(var0.anInt995 * -960308681) {
         case 0:
            return 51;
         case 1:
            return 77;
         case 2:
            return Class27.anInt342 * -558823211;
         case 3:
            return 22;
         case 4:
         case 8:
         default:
            throw new IllegalArgumentException("");
         case 5:
            return 28;
         case 6:
            return Class27.anInt341 * 1730706231;
         case 7:
            return 50;
         case 9:
            return 21;
         }
      case 3:
         if(var0 == Class98.aClass98_992) {
            return 116;
         }
         break;
      case 8:
         if(var0 == Class98.aClass98_992) {
            return 113;
         }
      }

      throw new IllegalArgumentException("");
   }

   static final int method15856(Class91 var0) {
      if(var0 == Class91.aClass91_899) {
         return 80;
      } else if(var0 == Class91.aClass91_901) {
         return 77;
      } else {
         throw new IllegalArgumentException("");
      }
   }

   static final int method15857(Class374 var0) {
      switch(var0.anInt4673) {
      case 0:
         return 1;
      case 1:
         return 5;
      case 2:
         return 6;
      case 3:
         return 4;
      case 4:
         return 2;
      case 5:
         return 3;
      default:
         throw new IllegalArgumentException("");
      }
   }

   public void method11717(boolean var1) {}

   public void method15304(int var1, Interface35 var2) {
      Class319 var3 = (Class319)var2;
      IDirect3DDevice.SetStreamSource(this.aLong10294, var1, var3.aLong4010, 0, var3.method5760());
   }

   synchronized void method15858(long var1) {
      if(this.anInt10318 == this.anInt10317) {
         this.anInt10317 *= 2;
         long[] var3 = new long[this.anInt10317];
         System.arraycopy(this.aLongArray10319, 0, var3, 0, this.anInt10318);
         this.aLongArray10319 = var3;
      }

      this.aLongArray10319[this.anInt10318] = var1;
      ++this.anInt10318;
   }

   void method15089(int var1) {
      if(!this.aBool10315) {
         int var2 = (var1 & 2) != 0?2:3;
         IDirect3DDevice.SetRenderState(this.aLong10294, 8, var2);
      }

   }

   void method15069() {
      IDirect3DDevice.method14453(this.aLong10294, 15, this.aBool9756);
   }

   void method11522(int var1, int var2) throws Exception_Sub5 {
      IDirect3DDevice.EndScene(this.aLong10294);
      int var3 = this.aClass151_Sub2_7358.method14944();
      if(Class23.method812(var3)) {
         if(var3 != -2005530520) {
            if(++this.anInt10297 > 50) {
               throw new Exception_Sub5(var3);
            }
         } else {
            this.aClass151_Sub2_7358.method10();
            this.method15860();
            ((Class151_Sub2_Sub2_Sub2)this.aClass151_Sub2_7358).method151();
         }
      } else {
         this.anInt10297 = 0;
      }

      IDirect3DDevice.BeginScene(this.aLong10294);
      if(this.anInterface24_7370 != null) {
         this.anInterface24_7370.method117((byte)123);
      }

   }

   void method11523(int var1, int var2) throws Exception_Sub5 {
      IDirect3DDevice.EndScene(this.aLong10294);
      int var3 = this.aClass151_Sub2_7358.method14944();
      if(Class23.method812(var3)) {
         if(var3 != -2005530520) {
            if(++this.anInt10297 > 50) {
               throw new Exception_Sub5(var3);
            }
         } else {
            this.aClass151_Sub2_7358.method10();
            this.method15860();
            ((Class151_Sub2_Sub2_Sub2)this.aClass151_Sub2_7358).method151();
         }
      } else {
         this.anInt10297 = 0;
      }

      IDirect3DDevice.BeginScene(this.aLong10294);
      if(this.anInterface24_7370 != null) {
         this.anInterface24_7370.method117((byte)19);
      }

   }

   public void method11524() {
      long var1 = IDirect3DDevice.CreateEventQuery(this.aLong10294);
      if(Class23.method813(IDirect3DEventQuery.Issue(var1))) {
         while(true) {
            int var3 = IDirect3DEventQuery.IsSignaled(var1);
            if(var3 != 1) {
               break;
            }

            Thread.yield();
         }
      }

      IUnknown.Release(var1);
   }

   final void method15859(Class329_Sub2 var1) {
      this.method15851(var1);
      if(this.aBoolArray10302[this.anInt9625] != var1.aBool8088) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, var1.aBool8088?1:3);
         this.aBoolArray10302[this.anInt9625] = var1.aBool8088;
      }

      if(this.aBoolArray10312[this.anInt9625] != var1.aBool8084) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, var1.aBool8084?1:3);
         this.aBoolArray10312[this.anInt9625] = var1.aBool8084;
      }

   }

   public void method11526() {
      long var1 = IDirect3DDevice.CreateEventQuery(this.aLong10294);
      if(Class23.method813(IDirect3DEventQuery.Issue(var1))) {
         while(true) {
            int var3 = IDirect3DEventQuery.IsSignaled(var1);
            if(var3 != 1) {
               break;
            }

            Thread.yield();
         }
      }

      IUnknown.Release(var1);
   }

   void method11527() {
      super.method11470();
      if(this.aLong10298 != 0L) {
         D3DLIGHT.Destroy(this.aLong10298);
         this.aLong10298 = 0L;
      }

      if(this.aLong10299 != 0L) {
         D3DLIGHT.Destroy(this.aLong10299);
         this.aLong10299 = 0L;
      }

      if(this.aLong10300 != 0L) {
         D3DLIGHT.Destroy(this.aLong10300);
         this.aLong10300 = 0L;
      }

      if(this.aLong10294 != 0L) {
         IDirect3DDevice.Destroy(this.aLong10294);
         this.aLong10294 = 0L;
      }

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

   }

   void method11528() {
      super.method11470();
      if(this.aLong10298 != 0L) {
         D3DLIGHT.Destroy(this.aLong10298);
         this.aLong10298 = 0L;
      }

      if(this.aLong10299 != 0L) {
         D3DLIGHT.Destroy(this.aLong10299);
         this.aLong10299 = 0L;
      }

      if(this.aLong10300 != 0L) {
         D3DLIGHT.Destroy(this.aLong10300);
         this.aLong10300 = 0L;
      }

      if(this.aLong10294 != 0L) {
         IDirect3DDevice.Destroy(this.aLong10294);
         this.aLong10294 = 0L;
      }

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

   }

   Interface3 method15133(Class98 var1, int var2, int var3, int var4, boolean var5, byte[] var6) {
      return new Class329_Sub1(this, var1, var2, var3, var4, var5, var6);
   }

   void method11697() {
      super.finalize();
   }

   public final synchronized void method11531(int var1) {
      for(int var2 = 0; var2 < this.anInt10318; ++var2) {
         IUnknown.Release(this.aLongArray10319[var2]);
      }

      this.anInt10318 = 0;
      super.method11433(var1);
   }

   public void method11541(boolean var1) {}

   public void method11542(boolean var1) {}

   public void finalize() {
      super.finalize();
   }

   public Interface8 method11659(int var1, int var2, int var3) {
      return new Class320(this, Class91.aClass91_901, var1, var2, var3);
   }

   Class151_Sub2 method11545(Canvas var1, int var2, int var3) {
      return new Class151_Sub2_Sub2_Sub2(this, var1, var2, var3, false);
   }

   Class151_Sub2 method11619(Canvas var1, int var2, int var3) {
      return new Class151_Sub2_Sub2_Sub2(this, var1, var2, var3, false);
   }

   Class151_Sub2 method11489(Canvas var1, int var2, int var3) {
      return new Class151_Sub2_Sub2_Sub2(this, var1, var2, var3, false);
   }

   public void method11428() {}

   void method11529() {
      super.method11470();
      if(this.aLong10298 != 0L) {
         D3DLIGHT.Destroy(this.aLong10298);
         this.aLong10298 = 0L;
      }

      if(this.aLong10299 != 0L) {
         D3DLIGHT.Destroy(this.aLong10299);
         this.aLong10299 = 0L;
      }

      if(this.aLong10300 != 0L) {
         D3DLIGHT.Destroy(this.aLong10300);
         this.aLong10300 = 0L;
      }

      if(this.aLong10294 != 0L) {
         IDirect3DDevice.Destroy(this.aLong10294);
         this.aLong10294 = 0L;
      }

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

   }

   public Class79 method11623(Class79 var1, Class79 var2, float var3, Class79 var4) {
      return var3 < 0.5F?var1:var2;
   }

   public Class79 method11624(Class79 var1, Class79 var2, float var3, Class79 var4) {
      return var3 < 0.5F?var1:var2;
   }

   void method15277(boolean var1) {
      IDirect3DDevice.method14453(this.aLong10294, 161, var1);
   }

   public Class151_Sub1 method11654() {
      return new Class151_Sub1_Sub1_Sub2(this);
   }

   public Class151_Sub1 method11655() {
      return new Class151_Sub1_Sub1_Sub2(this);
   }

   Interface33 method15245(int var1, int var2, boolean var3, int[] var4, int var5, int var6) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6);
   }

   public Interface7 method11455(int var1, int var2, Class98 var3, Class91 var4, int var5) {
      return new Class324(this, var3, var4, var1, var2, var5);
   }

   public Interface8 method11722(int var1, int var2) {
      return new Class320(this, Class91.aClass91_901, var1, var2, 0);
   }

   public final void method15318(Class374 var1, int var2, int var3, int var4, int var5) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawIndexedPrimitive(this.aLong10294, method15857(var1), 0, var2, var3, var4, var5);
   }

   void method11660() {
      super.finalize();
   }

   void method15224() {
      IDirect3DDevice.method14453(this.aLong10294, 7, this.aBool9616);
   }

   void method15226() {
      IDirect3DDevice.method14453(this.aLong10294, 14, this.aBool9713 && this.aBool9691);
   }

   boolean method15860() {
      int var1 = IDirect3DDevice.TestCooperativeLevel(this.aLong10294);
      if(var1 == 0 || var1 == -2005530519) {
         IDirect3DDevice.SetDepthStencilSurface(this.aLong10294, 0L);

         int var2;
         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetRenderTarget(this.aLong10294, var2, 0L);
         }

         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetStreamSource(this.aLong10294, var2, 0L, 0, 0);
         }

         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetTexture(this.aLong10294, var2, 0L);
         }

         IDirect3DDevice.SetIndices(this.aLong10294, 0L);
         this.method15185();
         this.aD3DPRESENT_PARAMETERS10295.BackBufferWidth = 0;
         this.aD3DPRESENT_PARAMETERS10295.BackBufferHeight = 0;
         if(method15867(this.anInt10291, this.anInt10292, this.aLong10293, this.anInt9757, this.aD3DPRESENT_PARAMETERS10295)) {
            var2 = IDirect3DDevice.Reset(this.aLong10294, this.aD3DPRESENT_PARAMETERS10295);
            if(Class23.method813(var2)) {
               this.method14977();
               this.method15112();
               return true;
            }

            System.exit(0);
         }
      }

      return false;
   }

   Class151_Sub2 method11578(Canvas var1, int var2, int var3) {
      return new Class151_Sub2_Sub2_Sub2(this, var1, var2, var3, false);
   }

   public int[] kc(int var1, int var2, int var3, int var4) {
      int[] var5 = null;
      long var6 = IDirect3DDevice.GetRenderTarget(this.aLong10294, 0);
      long var8 = IDirect3DDevice.CreateRenderTarget(this.aLong10294, var3, var4, 21, 0, 0, true);
      if(Class23.method813(IDirect3DDevice.StretchRect(this.aLong10294, var6, var1, var2, var3, var4, var8, 0, 0, var3, var4, 1))) {
         var5 = new int[var3 * var4];
         IDirect3DSurface.Download(var8, 0, 0, var3, var4, var3 * 4, 16, this.aLong9730);
         this.aByteBuffer9763.clear();
         this.aByteBuffer9763.asIntBuffer().get(var5);
      }

      IUnknown.Release(var6);
      IUnknown.Release(var8);
      return var5;
   }

   public void kz(int var1, int var2) {
      IDirect3DDevice.Clear(this.aLong10294, var1, var2, 1.0F, 0);
   }

   public void kd(int var1, int var2) {
      IDirect3DDevice.Clear(this.aLong10294, var1, var2, 1.0F, 0);
   }

   public void kv(int var1, int var2) {
      IDirect3DDevice.Clear(this.aLong10294, var1, var2, 1.0F, 0);
   }

   public Interface7 method11675(int var1, int var2, Class98 var3, Class91 var4, int var5) {
      return new Class324(this, var3, var4, var1, var2, var5);
   }

   public boolean method15092() {
      return (this.aD3DCAPS10311.VertexShaderVersion & '\uffff') >= 257;
   }

   public float method14983() {
      return -0.5F;
   }

   public Class103 method15233(String var1) {
      byte[] var2 = this.method15870(var1);
      if(var2 == null) {
         return null;
      } else {
         Class28 var3 = this.method14970(var2);
         return new Class103_Sub2(this, var3);
      }
   }

   public void method15214(Class317 var1, Class317 var2, Class317 var3) {
      IDirect3DDevice.SetTransform(this.aLong10294, 256, var1.aFloatArray4000);
      IDirect3DDevice.SetTransform(this.aLong10294, 2, var2.aFloatArray4000);
      IDirect3DDevice.SetTransform(this.aLong10294, 3, var3.aFloatArray4000);
   }

   public void method15148(Class317 var1, Class317 var2, Class317 var3) {
      IDirect3DDevice.SetTransform(this.aLong10294, 256, var1.aFloatArray4000);
      IDirect3DDevice.SetTransform(this.aLong10294, 2, var2.aFloatArray4000);
      IDirect3DDevice.SetTransform(this.aLong10294, 3, var3.aFloatArray4000);
   }

   void method15037() {
      int var1;
      for(var1 = 0; var1 < this.anInt9709; ++var1) {
         Class225_Sub40 var2 = this.aClass225_Sub40Array9719[var1];
         int var3 = var1 + 2;
         int var4 = var2.method14107(-1635550607);
         float var5 = var2.method14110(1647909557) / 255.0F;
         D3DLIGHT.SetPosition(this.aLong10300, (float)var2.method14103(982286037), (float)var2.method14104(-1433333523), (float)var2.method14105((byte)50));
         D3DLIGHT.SetDiffuse(this.aLong10300, (float)(var4 >> 16 & 255) * var5, (float)(var4 >> 8 & 255) * var5, (float)(var4 & 255) * var5, 0.0F);
         D3DLIGHT.SetAttenuation(this.aLong10300, 0.0F, 0.0F, 1.0F / (float)(var2.method14113(1119942165) * var2.method14113(2080815994)));
         D3DLIGHT.SetRange(this.aLong10300, (float)var2.method14113(1480781350));
         IDirect3DDevice.SetLight(this.aLong10294, var3, this.aLong10300);
         IDirect3DDevice.LightEnable(this.aLong10294, var3, true);
      }

      while(var1 < this.anInt9708) {
         IDirect3DDevice.LightEnable(this.aLong10294, var1 + 2, false);
         ++var1;
      }

   }

   void method15153() {
      for(int var1 = 0; var1 < this.anInt9764; ++var1) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 7, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 6, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 5, 2);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 1, 1);
         IDirect3DDevice.SetSamplerState(this.aLong10294, var1, 2, 1);
         this.aClass353Array10306[var1] = Class353.aClass353_4462;
         boolean[] var2 = this.aBoolArray10302;
         this.aBoolArray10312[var1] = true;
         var2[var1] = true;
         this.aBoolArray10305[var1] = false;
         this.anIntArray10307[var1] = 0;
      }

      IDirect3DDevice.SetTextureStageState(this.aLong10294, 0, 6, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 9, 2);
      IDirect3DDevice.SetRenderState(this.aLong10294, 23, 4);
      IDirect3DDevice.SetRenderState(this.aLong10294, 25, 5);
      IDirect3DDevice.SetRenderState(this.aLong10294, 24, 0);
      IDirect3DDevice.SetRenderState(this.aLong10294, 22, 2);
      IDirect3DDevice.SetRenderState(this.aLong10294, 147, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 145, 1);
      IDirect3DDevice.method14452(this.aLong10294, 38, 0.95F);
      IDirect3DDevice.SetRenderState(this.aLong10294, 35, 3);
      IDirect3DDevice.method14452(this.aLong10294, 154, 1.0F);
      D3DLIGHT.SetType(this.aLong10298, 3);
      D3DLIGHT.SetType(this.aLong10299, 3);
      D3DLIGHT.SetType(this.aLong10300, 1);
      IDirect3DDevice.SetRenderState(this.aLong10294, 206, 1);
      this.aBool10301 = false;
      super.method15112();
   }

   void method15090() {
      for(ObjectVar var1 = (ObjectVar)this.aClass456_10296.method7682((byte)97); var1 != null; var1 = (ObjectVar)this.aClass456_10296.method7666(-204451711)) {
         Interface28 var2 = (Interface28)var1.object;
         var2.method10();
      }

      super.method15185();
   }

   final void method15082(Interface40 var1, Class374 var2, int var3, int var4, int var5, int var6) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawIndexedPrimitiveIB(this.aLong10294, ((Class380)var1).aLong4720, 4, 0, var3, var4, var5, var6);
   }

   public float method15162() {
      return -0.5F;
   }

   public float method15127() {
      return -0.5F;
   }

   public float method15320() {
      return -0.5F;
   }

   public float method15315() {
      return -0.5F;
   }

   void method15179() {
      if(this.aClass151_7359 != null) {
         IDirect3DDevice.SetViewport(this.aLong10294, this.anInt9688 + this.anInt9619, this.anInt9689 + this.anInt9643, this.anInt9686, this.anInt9753, this.aFloat9670, this.aFloat9671);
      }

   }

   void method15180() {
      if(this.aClass151_7359 != null) {
         IDirect3DDevice.SetViewport(this.aLong10294, this.anInt9688 + this.anInt9619, this.anInt9689 + this.anInt9643, this.anInt9686, this.anInt9753, this.aFloat9670, this.aFloat9671);
      }

   }

   void method15181() {
      if(this.aClass151_7359 != null) {
         IDirect3DDevice.SetViewport(this.aLong10294, this.anInt9688 + this.anInt9619, this.anInt9689 + this.anInt9643, this.anInt9686, this.anInt9753, this.aFloat9670, this.aFloat9671);
      }

   }

   void method15182() {
      if(this.aClass151_7359 != null) {
         IDirect3DDevice.SetViewport(this.aLong10294, this.anInt9688 + this.anInt9619, this.anInt9689 + this.anInt9643, this.anInt9686, this.anInt9753, this.aFloat9670, this.aFloat9671);
      }

   }

   void method15861(Interface28 var1) {
      if(this.method15845(var1) == null) {
         this.aClass456_10296.method7712(new ObjectVar(var1), (byte)21);
      }

   }

   void method15184() {
      IDirect3DDevice.SetScissorRect(this.aLong10294, this.anInt9688 + this.anInt9678, this.anInt9689 + this.anInt9735, this.anInt9679, this.anInt9745);
   }

   void method15080() {
      IDirect3DDevice.SetScissorRect(this.aLong10294, this.anInt9688 + this.anInt9678, this.anInt9689 + this.anInt9735, this.anInt9679, this.anInt9745);
   }

   void method15186() {
      IDirect3DDevice.method14453(this.aLong10294, 174, this.aBool9783);
   }

   void method15187() {
      IDirect3DDevice.method14453(this.aLong10294, 174, this.aBool9783);
   }

   public void method11525() {
      long var1 = IDirect3DDevice.CreateEventQuery(this.aLong10294);
      if(Class23.method813(IDirect3DEventQuery.Issue(var1))) {
         while(true) {
            int var3 = IDirect3DEventQuery.IsSignaled(var1);
            if(var3 != 1) {
               break;
            }

            Thread.yield();
         }
      }

      IUnknown.Release(var1);
   }

   void method15232() {
      if(this.aBool9681 && !this.aBool10301) {
         IDirect3DDevice.LightEnable(this.aLong10294, 0, false);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, false);
         IDirect3DDevice.SetLight(this.aLong10294, 0, this.aLong10298);
         IDirect3DDevice.SetLight(this.aLong10294, 1, this.aLong10299);
         IDirect3DDevice.LightEnable(this.aLong10294, 0, true);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, true);
         this.aBool10301 = true;
      }

   }

   static final int method15862(Class368 var0) {
      switch(var0.anInt4621) {
      case 0:
         return 1;
      case 1:
         return 256;
      case 2:
         return 2;
      case 3:
      default:
         return 0;
      case 4:
         return 3;
      case 5:
         return 4;
      }
   }

   void method15222() {
      IDirect3DDevice.method14453(this.aLong10294, 7, this.aBool9616);
   }

   public void method15302(Class341 var1) {
      Class341_Sub1 var2 = (Class341_Sub1)var1;
      IDirect3DDevice.SetVertexDeclaration(this.aLong10294, var2.aLong8150);
   }

   void method15225() {
      IDirect3DDevice.method14453(this.aLong10294, 7, this.aBool9616);
   }

   final void method15863(long var1) {
      this.aLong10310 = var1;
      IDirect3DDevice.SetVertexShader(this.aLong10294, var1);
   }

   void method15278() {
      if(this.aBool9681) {
         IDirect3DDevice.method14453(this.aLong10294, 137, this.aBool9685 && !this.aBool9630);
      }

   }

   void method15228() {
      if(this.aBool9681) {
         IDirect3DDevice.method14453(this.aLong10294, 137, this.aBool9685 && !this.aBool9630);
      }

   }

   final void method15864(Class329_Sub1 var1) {
      this.method15851(var1);
      if(!this.aBoolArray10302[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, 1);
         this.aBoolArray10302[this.anInt9625] = true;
      }

      if(!this.aBoolArray10312[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, 1);
         this.aBoolArray10312[this.anInt9625] = true;
      }

   }

   void method15176() {
      if(this.aBool9681) {
         float var1 = this.aBool9733?this.aFloat9705:0.0F;
         float var2 = this.aBool9733?-this.aFloat9706:0.0F;
         D3DLIGHT.SetDiffuse(this.aLong10298, var1 * this.aFloat9701, var1 * this.aFloat9702, var1 * this.aFloat9703, 0.0F);
         D3DLIGHT.SetDiffuse(this.aLong10299, var2 * this.aFloat9701, var2 * this.aFloat9702, var2 * this.aFloat9703, 0.0F);
         this.aBool10301 = false;
      }

   }

   void method15229() {
      if(this.aBool9681) {
         float var1 = this.aBool9733?this.aFloat9705:0.0F;
         float var2 = this.aBool9733?-this.aFloat9706:0.0F;
         D3DLIGHT.SetDiffuse(this.aLong10298, var1 * this.aFloat9701, var1 * this.aFloat9702, var1 * this.aFloat9703, 0.0F);
         D3DLIGHT.SetDiffuse(this.aLong10299, var2 * this.aFloat9701, var2 * this.aFloat9702, var2 * this.aFloat9703, 0.0F);
         this.aBool10301 = false;
      }

   }

   void method15230() {
      if(this.aBool9681) {
         float var1 = this.aBool9733?this.aFloat9705:0.0F;
         float var2 = this.aBool9733?-this.aFloat9706:0.0F;
         D3DLIGHT.SetDiffuse(this.aLong10298, var1 * this.aFloat9701, var1 * this.aFloat9702, var1 * this.aFloat9703, 0.0F);
         D3DLIGHT.SetDiffuse(this.aLong10299, var2 * this.aFloat9701, var2 * this.aFloat9702, var2 * this.aFloat9703, 0.0F);
         this.aBool10301 = false;
      }

   }

   void method15865(Interface28 var1) {
      ObjectVar var2 = this.method15845(var1);
      if(var2 != null) {
         var2.method3857(-1659339211);
      }

   }

   void method11470() {
      super.method11470();
      if(this.aLong10298 != 0L) {
         D3DLIGHT.Destroy(this.aLong10298);
         this.aLong10298 = 0L;
      }

      if(this.aLong10299 != 0L) {
         D3DLIGHT.Destroy(this.aLong10299);
         this.aLong10299 = 0L;
      }

      if(this.aLong10300 != 0L) {
         D3DLIGHT.Destroy(this.aLong10300);
         this.aLong10300 = 0L;
      }

      if(this.aLong10294 != 0L) {
         IDirect3DDevice.Destroy(this.aLong10294);
         this.aLong10294 = 0L;
      }

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

   }

   void method15280() {
      switch(this.aClass57_9674.anInt532) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 5);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 6);
         break;
      case 3:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 9);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
      }

      switch(this.anInt9742) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 1);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 2);
      }

   }

   static final int method15866(Class98 var0, Class91 var1) {
      switch(var1.anInt905 * -1560869161) {
      case 2:
         switch(var0.anInt995 * -960308681) {
         case 0:
            return 51;
         case 1:
            return 77;
         case 2:
            return Class27.anInt342 * -558823211;
         case 3:
            return 22;
         case 4:
         case 8:
         default:
            throw new IllegalArgumentException("");
         case 5:
            return 28;
         case 6:
            return Class27.anInt341 * 1730706231;
         case 7:
            return 50;
         case 9:
            return 21;
         }
      case 3:
         if(var0 == Class98.aClass98_992) {
            return 116;
         }
         break;
      case 8:
         if(var0 == Class98.aClass98_992) {
            return 113;
         }
      }

      throw new IllegalArgumentException("");
   }

   void method15234() {
      if(this.aBool9681 && !this.aBool10301) {
         IDirect3DDevice.LightEnable(this.aLong10294, 0, false);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, false);
         IDirect3DDevice.SetLight(this.aLong10294, 0, this.aLong10298);
         IDirect3DDevice.SetLight(this.aLong10294, 1, this.aLong10299);
         IDirect3DDevice.LightEnable(this.aLong10294, 0, true);
         IDirect3DDevice.LightEnable(this.aLong10294, 1, true);
         this.aBool10301 = true;
      }

   }

   void method15235() {
      this.method15032();
      this.method15034();
   }

   void method15140() {
      this.method15032();
      this.method15034();
   }

   void method15236() {
      this.method15032();
      this.method15034();
   }

   boolean method15321(Class98 var1, Class91 var2) {
      D3DDISPLAYMODE var3 = new D3DDISPLAYMODE();
      return Class23.method813(IDirect3D.GetAdapterDisplayMode(this.aLong10293, this.anInt10291, var3)) && Class23.method813(IDirect3D.CheckDeviceFormat(this.aLong10293, this.anInt10291, this.anInt10292, var3.Format, 0, 4, method15855(var1, var2)));
   }

   void method15324(int var1) {
      if(!this.aBool10315) {
         int var2 = (var1 & 2) != 0?2:3;
         IDirect3DDevice.SetRenderState(this.aLong10294, 8, var2);
      }

   }

   Interface33 method15242(Class98 var1, int var2, int var3, boolean var4, byte[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   static boolean method15867(int var0, int var1, long var2, int var4, D3DPRESENT_PARAMETERS var5) {
      int var6 = 0;
      int var7 = 0;
      int var8 = 0;

      try {
         D3DDISPLAYMODE var9 = new D3DDISPLAYMODE();
         if(Class23.method812(IDirect3D.GetAdapterDisplayMode(var2, var0, var9))) {
            return false;
         } else {
            label71:
            for(; var4 >= 0; --var4) {
               if(var4 != 1) {
                  var8 = 0 + var4;

                  for(int var10 = 0; var10 < anIntArray10321.length; ++var10) {
                     if(IDirect3D.CheckDeviceType(var2, var0, var1, var9.Format, anIntArray10321[var10], true) == 0 && IDirect3D.CheckDeviceFormat(var2, var0, var1, var9.Format, 1, 1, anIntArray10321[var10]) == 0 && (var4 == 0 || IDirect3D.CheckDeviceMultiSampleType(var2, var0, var1, anIntArray10321[var10], true, var8) == 0)) {
                        for(int var11 = 0; var11 < anIntArray10308.length; ++var11) {
                           if(IDirect3D.CheckDeviceFormat(var2, var0, var1, var9.Format, 2, 1, anIntArray10308[var11]) == 0 && IDirect3D.CheckDepthStencilMatch(var2, var0, var1, var9.Format, anIntArray10321[var10], anIntArray10308[var11]) == 0 && (var4 == 0 || IDirect3D.CheckDeviceMultiSampleType(var2, var0, var1, anIntArray10308[var10], true, var8) == 0)) {
                              var7 = anIntArray10321[var10];
                              var6 = anIntArray10308[var11];
                              break label71;
                           }
                        }
                     }
                  }
               }
            }

            if(var4 >= 0 && var7 != 0 && var6 != 0) {
               var5.BackBufferFormat = var7;
               var5.AutoDepthStencilFormat = var6;
               var5.MultiSampleType = var8;
               var5.MultiSampleQuality = 0;
               return true;
            } else {
               return false;
            }
         }
      } catch (Throwable var12) {
         return false;
      }
   }

   public Class79 method11644(Class79 var1, Class79 var2, float var3, Class79 var4) {
      return var3 < 0.5F?var1:var2;
   }

   Interface33 method15244(Class98 var1, int var2, int var3, boolean var4, float[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   boolean method15868() {
      int var1 = IDirect3DDevice.TestCooperativeLevel(this.aLong10294);
      if(var1 == 0 || var1 == -2005530519) {
         IDirect3DDevice.SetDepthStencilSurface(this.aLong10294, 0L);

         int var2;
         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetRenderTarget(this.aLong10294, var2, 0L);
         }

         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetStreamSource(this.aLong10294, var2, 0L, 0, 0);
         }

         for(var2 = 0; var2 < 4; ++var2) {
            IDirect3DDevice.SetTexture(this.aLong10294, var2, 0L);
         }

         IDirect3DDevice.SetIndices(this.aLong10294, 0L);
         this.method15185();
         this.aD3DPRESENT_PARAMETERS10295.BackBufferWidth = 0;
         this.aD3DPRESENT_PARAMETERS10295.BackBufferHeight = 0;
         if(method15867(this.anInt10291, this.anInt10292, this.aLong10293, this.anInt9757, this.aD3DPRESENT_PARAMETERS10295)) {
            var2 = IDirect3DDevice.Reset(this.aLong10294, this.aD3DPRESENT_PARAMETERS10295);
            if(Class23.method813(var2)) {
               this.method14977();
               this.method15112();
               return true;
            }

            System.exit(0);
         }
      }

      return false;
   }

   void method15332() {
      if(this.aLong10310 == 0L && this.aClass368Array9717[this.anInt9625] != Class368.aClass368_4615) {
         if(this.aClass368Array9717[this.anInt9625] == Class368.aClass368_4619) {
            IDirect3DDevice.SetTransform(this.aLong10294, 16 + this.anInt9625, this.aClass317Array9716[this.anInt9625].method5642(this.aFloatArray10314));
         } else {
            IDirect3DDevice.SetTransform(this.aLong10294, 16 + this.anInt9625, this.aClass317Array9716[this.anInt9625].method5636(this.aFloatArray10314));
         }

         int var1 = method15862(this.aClass368Array9717[this.anInt9625]);
         if(var1 != this.anIntArray10307[this.anInt9625]) {
            IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 24, var1);
            this.anIntArray10307[this.anInt9625] = var1;
         }
      } else {
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 24, 0);
         this.anIntArray10307[this.anInt9625] = 0;
      }

   }

   Interface37 method15247(int var1, boolean var2, int[][] var3) {
      return new Class329_Sub3(this, var1, var2, var3);
   }

   Interface3 method15248(Class98 var1, int var2, int var3, int var4, boolean var5, byte[] var6) {
      return new Class329_Sub1(this, var1, var2, var3, var4, var5, var6);
   }

   void method15284() {
      if(this.aBool9681) {
         D3DLIGHT.SetDirection(this.aLong10298, -this.aFloatArray9712[0], -this.aFloatArray9712[1], -this.aFloatArray9712[2]);
         D3DLIGHT.SetDirection(this.aLong10299, -this.aFloatArray9697[0], -this.aFloatArray9697[1], -this.aFloatArray9697[2]);
         this.aBool10301 = false;
      }

   }

   void method15271() {}

   Interface36 method15250(Class98 var1, Class91 var2, int var3, int var4) {
      return new Class329_Sub2_Sub1(this, var1, var2, var3, var4);
   }

   public void method15253() {
      if(this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = false;
         IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, 0L);
         this.method15083();
         this.method15126();
      }

   }

   public void method15254() {
      if(this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = false;
         IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, 0L);
         this.method15083();
         this.method15126();
      }

   }

   Interface33 method15099(Class98 var1, int var2, int var3, boolean var4, float[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   final void method15262(int var1, Class351 var2, boolean var3, boolean var4) {
      if(this.aBool9681) {
         int var5 = 0;
         byte var6;
         switch(var1) {
         case 1:
            var6 = 3;
            break;
         case 2:
            var6 = 26;
            break;
         default:
            var6 = 2;
         }

         if(var3) {
            var5 |= 32;
         }

         if(var4) {
            var5 |= 16;
         }

         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, var6, method15872(var2) | var5);
      }

   }

   final void method15026(int var1, Class351 var2, boolean var3) {
      if(this.aBool9681) {
         int var4 = 0;
         byte var5;
         switch(var1) {
         case 1:
            var5 = 6;
            break;
         case 2:
            var5 = 27;
            break;
         default:
            var5 = 5;
         }

         if(var3) {
            var4 |= 16;
         }

         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, var5, method15872(var2) | var4);
      }

   }

   public boolean method14967() {
      return (this.aD3DCAPS10311.VertexShaderVersion & '\uffff') >= 257;
   }

   final void method15114() {
      if(this.aBool9681) {
         IDirect3DDevice.SetRenderState(this.aLong10294, 60, this.anInt9720);
      }

   }

   void method15270() {}

   public void method15303(Class341 var1) {
      Class341_Sub1 var2 = (Class341_Sub1)var1;
      IDirect3DDevice.SetVertexDeclaration(this.aLong10294, var2.aLong8150);
   }

   public Class85 method11427() {
      D3DADAPTER_IDENTIFIER var1 = new D3DADAPTER_IDENTIFIER();
      IDirect3D.GetAdapterIdentifier(this.aLong10293, this.anInt10291, 0, var1);
      return new Class85(var1.VendorID, "Direct3D", 9, var1.Description, var1.DriverVersion);
   }

   void method15273() {
      if(this.aBool9681) {
         int var1 = this.aBoolArray10304[this.anInt9625]?method15853(this.aClass367Array9718[this.anInt9625]):1;
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 1, var1);
      }

   }

   void method15110() {
      if(this.aBool9681) {
         int var1 = this.aBoolArray10304[this.anInt9625]?method15853(this.aClass367Array9743[this.anInt9625]):1;
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 4, var1);
      }

   }

   static final int method15869(Class98 var0, Class91 var1) {
      switch(var1.anInt905 * -1560869161) {
      case 2:
         switch(var0.anInt995 * -960308681) {
         case 0:
            return 51;
         case 1:
            return 77;
         case 2:
            return Class27.anInt342 * -558823211;
         case 3:
            return 22;
         case 4:
         case 8:
         default:
            throw new IllegalArgumentException("");
         case 5:
            return 28;
         case 6:
            return Class27.anInt341 * 1730706231;
         case 7:
            return 50;
         case 9:
            return 21;
         }
      case 3:
         if(var0 == Class98.aClass98_992) {
            return 116;
         }
         break;
      case 8:
         if(var0 == Class98.aClass98_992) {
            return 113;
         }
      }

      throw new IllegalArgumentException("");
   }

   void method15216(int var1) {
      IDirect3DDevice.SetRenderState(this.aLong10294, 168, var1);
   }

   void method15029(int var1) {
      IDirect3DDevice.SetRenderState(this.aLong10294, 168, var1);
   }

   void method14976(int var1) {
      IDirect3DDevice.SetRenderState(this.aLong10294, 168, var1);
   }

   void method15188() {
      IDirect3DDevice.method14453(this.aLong10294, 174, this.aBool9783);
   }

   void method15095() {
      if(this.aBool9681) {
         D3DLIGHT.SetAmbient(this.aLong10298, this.aFloat9701 * this.aFloat9760, this.aFloat9702 * this.aFloat9760, this.aFloat9703 * this.aFloat9760, 0.0F);
         this.aBool10301 = false;
      }

   }

   void method15282() {
      switch(this.aClass57_9674.anInt532) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 5);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 6);
         break;
      case 3:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 9);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
      }

      switch(this.anInt9742) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 1);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 2);
      }

   }

   void method15283() {
      IDirect3DDevice.method14453(this.aLong10294, 27, this.aBool9755);
   }

   void method15116() {
      IDirect3DDevice.method14453(this.aLong10294, 27, this.aBool9755);
   }

   byte[] method15870(String var1) {
      return this.method14969("dx", var1);
   }

   void method15292() {
      this.aFloat9752 = this.aFloat9675 - (float)this.anInt9750;
      this.aFloat9751 = this.aFloat9752 - (float)this.anInt9623;
      if(this.aFloat9751 < this.aFloat9696) {
         this.aFloat9751 = this.aFloat9696;
      }

      if(this.aBool9681) {
         IDirect3DDevice.method14452(this.aLong10294, 36, this.aFloat9751);
         IDirect3DDevice.method14452(this.aLong10294, 37, this.aFloat9752);
         IDirect3DDevice.SetRenderState(this.aLong10294, 34, this.anInt9748);
      }

   }

   void method15293() {
      if(this.aBool9681) {
         IDirect3DDevice.method14453(this.aLong10294, 28, this.aBool9749 && this.aBool9746 && this.anInt9623 >= 0);
      }

   }

   void method15118() {
      if(this.aBool9681) {
         IDirect3DDevice.method14453(this.aLong10294, 28, this.aBool9749 && this.aBool9746 && this.anInt9623 >= 0);
      }

   }

   public int[] kx(int var1, int var2, int var3, int var4) {
      int[] var5 = null;
      long var6 = IDirect3DDevice.GetRenderTarget(this.aLong10294, 0);
      long var8 = IDirect3DDevice.CreateRenderTarget(this.aLong10294, var3, var4, 21, 0, 0, true);
      if(Class23.method813(IDirect3DDevice.StretchRect(this.aLong10294, var6, var1, var2, var3, var4, var8, 0, 0, var3, var4, 1))) {
         var5 = new int[var3 * var4];
         IDirect3DSurface.Download(var8, 0, 0, var3, var4, var3 * 4, 16, this.aLong9730);
         this.aByteBuffer9763.clear();
         this.aByteBuffer9763.asIntBuffer().get(var5);
      }

      IUnknown.Release(var6);
      IUnknown.Release(var8);
      return var5;
   }

   public final synchronized void method11530(int var1) {
      for(int var2 = 0; var2 < this.anInt10318; ++var2) {
         IUnknown.Release(this.aLongArray10319[var2]);
      }

      this.anInt10318 = 0;
      super.method11433(var1);
   }

   final Interface40 method15033(boolean var1) {
      return new Class380(this, Class91.aClass91_899, var1);
   }

   final Interface40 method15296(boolean var1) {
      return new Class380(this, Class91.aClass91_899, var1);
   }

   final Interface40 method15297(boolean var1) {
      return new Class380(this, Class91.aClass91_899, var1);
   }

   final Interface40 method15298(boolean var1) {
      return new Class380(this, Class91.aClass91_899, var1);
   }

   void method14982() {
      IDirect3DDevice.SetScissorRect(this.aLong10294, this.anInt9688 + this.anInt9678, this.anInt9689 + this.anInt9735, this.anInt9679, this.anInt9745);
   }

   Class341 method15177(Class348[] var1) {
      return new Class341_Sub1(this, var1);
   }

   Class341 method15300(Class348[] var1) {
      return new Class341_Sub1(this, var1);
   }

   void method15171() {
      if(this.aBool9681) {
         D3DLIGHT.SetDirection(this.aLong10298, -this.aFloatArray9712[0], -this.aFloatArray9712[1], -this.aFloatArray9712[2]);
         D3DLIGHT.SetDirection(this.aLong10299, -this.aFloatArray9697[0], -this.aFloatArray9697[1], -this.aFloatArray9697[2]);
         this.aBool10301 = false;
      }

   }

   Class151_Sub2 method11512(Canvas var1, int var2, int var3) {
      return new Class151_Sub2_Sub2_Sub2(this, var1, var2, var3, false);
   }

   final Interface35 method15195(boolean var1) {
      return new Class319(this, var1);
   }

   void method15281() {
      if(this.aBool9681) {
         D3DLIGHT.SetDirection(this.aLong10298, -this.aFloatArray9712[0], -this.aFloatArray9712[1], -this.aFloatArray9712[2]);
         D3DLIGHT.SetDirection(this.aLong10299, -this.aFloatArray9697[0], -this.aFloatArray9697[1], -this.aFloatArray9697[2]);
         this.aBool10301 = false;
      }

   }

   public void method15201(Class317 var1) {
      var1.method5612(this.aClass317_10320);
   }

   void method15306(Interface40 var1) {
      IDirect3DDevice.SetIndices(this.aLong10294, ((Class380)var1).aLong4720);
   }

   void method15307(Interface40 var1) {
      IDirect3DDevice.SetIndices(this.aLong10294, ((Class380)var1).aLong4720);
   }

   public final synchronized void method11433(int var1) {
      for(int var2 = 0; var2 < this.anInt10318; ++var2) {
         IUnknown.Release(this.aLongArray10319[var2]);
      }

      this.anInt10318 = 0;
      super.method11433(var1);
   }

   final void method15317(Interface40 var1, Class374 var2, int var3, int var4, int var5, int var6) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawIndexedPrimitiveIB(this.aLong10294, ((Class380)var1).aLong4720, 4, 0, var3, var4, var5, var6);
   }

   void method15272() {
      if(this.aBool9681) {
         int var1 = this.aBoolArray10304[this.anInt9625]?method15853(this.aClass367Array9718[this.anInt9625]):1;
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 1, var1);
      }

   }

   public final void method15319(Class374 var1, int var2, int var3, int var4, int var5) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawIndexedPrimitive(this.aLong10294, method15857(var1), 0, var2, var3, var4, var5);
   }

   public final void method14996(Class374 var1, int var2, int var3, int var4, int var5) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawIndexedPrimitive(this.aLong10294, method15857(var1), 0, var2, var3, var4, var5);
   }

   void method15322(int var1) {
      if(!this.aBool10315) {
         int var2 = (var1 & 2) != 0?2:3;
         IDirect3DDevice.SetRenderState(this.aLong10294, 8, var2);
      }

   }

   void method15164(int var1) {
      if(!this.aBool10315) {
         int var2 = (var1 & 2) != 0?2:3;
         IDirect3DDevice.SetRenderState(this.aLong10294, 8, var2);
      }

   }

   void method15323(int var1) {
      if(!this.aBool10315) {
         int var2 = (var1 & 2) != 0?2:3;
         IDirect3DDevice.SetRenderState(this.aLong10294, 8, var2);
      }

   }

   void method15871(Interface28 var1) {
      ObjectVar var2 = this.method15845(var1);
      if(var2 != null) {
         var2.method3857(-1244712966);
      }

   }

   Interface33 method15163(Class98 var1, int var2, int var3, boolean var4, byte[] var5, int var6, int var7) {
      return new Class329_Sub2(this, var1, var2, var3, var4, var5, var6, var7);
   }

   public boolean method15326() {
      return (this.aD3DCAPS10311.PixelShaderVersion & '\uffff') >= 257;
   }

   public Class151_Sub1 method11454() {
      return new Class151_Sub1_Sub1_Sub2(this);
   }

   static final int method15872(Class351 var0) {
      switch(var0.anInt4459) {
      case 0:
         return 1;
      case 1:
         return 2;
      case 2:
         return 3;
      case 3:
         return 0;
      default:
         throw new IllegalArgumentException();
      }
   }

   Interface33 method15043(Class98 var1, Class91 var2, int var3, int var4) {
      return new Class329_Sub2(this, var1, var2, var3, var4);
   }

   ObjectVar method15873(Interface28 var1) {
      for(ObjectVar var2 = (ObjectVar)this.aClass456_10296.method7682((byte)39); var2 != null; var2 = (ObjectVar)this.aClass456_10296.method7666(-867992634)) {
         if(var2.object == var1) {
            return var2;
         }
      }

      return null;
   }

   ObjectVar method15874(Interface28 var1) {
      for(ObjectVar var2 = (ObjectVar)this.aClass456_10296.method7682((byte)20); var2 != null; var2 = (ObjectVar)this.aClass456_10296.method7666(-705222810)) {
         if(var2.object == var1) {
            return var2;
         }
      }

      return null;
   }

   ObjectVar method15875(Interface28 var1) {
      for(ObjectVar var2 = (ObjectVar)this.aClass456_10296.method7682((byte)29); var2 != null; var2 = (ObjectVar)this.aClass456_10296.method7666(-1725860390)) {
         if(var2.object == var1) {
            return var2;
         }
      }

      return null;
   }

   public void method11554(boolean var1) {}

   void method15876(Interface28 var1) {
      if(this.method15845(var1) == null) {
         this.aClass456_10296.method7712(new ObjectVar(var1), (byte)9);
      }

   }

   void method15877(Interface28 var1) {
      ObjectVar var2 = this.method15845(var1);
      if(var2 != null) {
         var2.method3857(-653445554);
      }

   }

   Interface3 method15047(Class98 var1, int var2, int var3, int var4, boolean var5, byte[] var6) {
      return new Class329_Sub1(this, var1, var2, var3, var4, var5, var6);
   }

   void method15083() {
      if(this.aBool9681) {
         int var1 = this.aBoolArray10304[this.anInt9625]?method15853(this.aClass367Array9743[this.anInt9625]):1;
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 4, var1);
      }

   }

   void method15878(Interface28 var1) {
      ObjectVar var2 = this.method15845(var1);
      if(var2 != null) {
         var2.method3857(-1203625320);
      }

   }

   Interface36 method15048(Class98 var1, Class91 var2, int var3, int var4) {
      return new Class329_Sub2_Sub1(this, var1, var2, var3, var4);
   }

   final void method15879(long var1) {
      IDirect3DDevice.SetPixelShader(this.aLong10294, var1);
   }

   final void method15880(long var1) {
      IDirect3DDevice.SetPixelShader(this.aLong10294, var1);
   }

   final void method15261(int var1, Class351 var2, boolean var3, boolean var4) {
      if(this.aBool9681) {
         int var5 = 0;
         byte var6;
         switch(var1) {
         case 1:
            var6 = 3;
            break;
         case 2:
            var6 = 26;
            break;
         default:
            var6 = 2;
         }

         if(var3) {
            var5 |= 32;
         }

         if(var4) {
            var5 |= 16;
         }

         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, var6, method15872(var2) | var5);
      }

   }

   void method15329() {
      int var1;
      for(var1 = 0; var1 < this.anInt9709; ++var1) {
         Class225_Sub40 var2 = this.aClass225_Sub40Array9719[var1];
         int var3 = var1 + 2;
         int var4 = var2.method14107(-1760947154);
         float var5 = var2.method14110(-980597044) / 255.0F;
         D3DLIGHT.SetPosition(this.aLong10300, (float)var2.method14103(-392412404), (float)var2.method14104(-1599249193), (float)var2.method14105((byte)11));
         D3DLIGHT.SetDiffuse(this.aLong10300, (float)(var4 >> 16 & 255) * var5, (float)(var4 >> 8 & 255) * var5, (float)(var4 & 255) * var5, 0.0F);
         D3DLIGHT.SetAttenuation(this.aLong10300, 0.0F, 0.0F, 1.0F / (float)(var2.method14113(1361944720) * var2.method14113(1964668296)));
         D3DLIGHT.SetRange(this.aLong10300, (float)var2.method14113(2131075225));
         IDirect3DDevice.SetLight(this.aLong10294, var3, this.aLong10300);
         IDirect3DDevice.LightEnable(this.aLong10294, var3, true);
      }

      while(var1 < this.anInt9708) {
         IDirect3DDevice.LightEnable(this.aLong10294, var1 + 2, false);
         ++var1;
      }

   }

   boolean method15330(Class98 var1, Class91 var2) {
      D3DDISPLAYMODE var3 = new D3DDISPLAYMODE();
      return Class23.method813(IDirect3D.GetAdapterDisplayMode(this.aLong10293, this.anInt10291, var3)) && Class23.method813(IDirect3D.CheckDeviceFormat(this.aLong10293, this.anInt10291, this.anInt10292, var3.Format, 0, 3, method15855(var1, var2)));
   }

   Interface33 method15067(Class98 var1, Class91 var2, int var3, int var4) {
      return new Class329_Sub2(this, var1, var2, var3, var4);
   }

   final void method15881(Class329 var1) {
      IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, var1.method6066());
      if(this.aBool9681 && !this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = true;
         this.method15083();
         this.method15126();
      }

   }

   final void method15882(Class329 var1) {
      IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, var1.method6066());
      if(this.aBool9681 && !this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = true;
         this.method15083();
         this.method15126();
      }

   }

   final void method15883(Class329 var1) {
      IDirect3DDevice.SetTexture(this.aLong10294, this.anInt9625, var1.method6066());
      if(this.aBool9681 && !this.aBoolArray10304[this.anInt9625]) {
         this.aBoolArray10304[this.anInt9625] = true;
         this.method15083();
         this.method15126();
      }

   }

   final void method15884(Class329_Sub2 var1) {
      this.method15851(var1);
      if(this.aBoolArray10302[this.anInt9625] != var1.aBool8088) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, var1.aBool8088?1:3);
         this.aBoolArray10302[this.anInt9625] = var1.aBool8088;
      }

      if(this.aBoolArray10312[this.anInt9625] != var1.aBool8084) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, var1.aBool8084?1:3);
         this.aBoolArray10312[this.anInt9625] = var1.aBool8084;
      }

   }

   final void method15885(Class329_Sub2 var1) {
      this.method15851(var1);
      if(this.aBoolArray10302[this.anInt9625] != var1.aBool8088) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, var1.aBool8088?1:3);
         this.aBoolArray10302[this.anInt9625] = var1.aBool8088;
      }

      if(this.aBoolArray10312[this.anInt9625] != var1.aBool8084) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, var1.aBool8084?1:3);
         this.aBoolArray10312[this.anInt9625] = var1.aBool8084;
      }

   }

   void method15128() {
      switch(this.aClass57_9674.anInt532) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 5);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 6);
         break;
      case 3:
         IDirect3DDevice.SetRenderState(this.aLong10294, 19, 9);
         IDirect3DDevice.SetRenderState(this.aLong10294, 20, 2);
      }

      switch(this.anInt9742) {
      case 0:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 1);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 1:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 1);
         break;
      case 2:
         IDirect3DDevice.SetRenderState(this.aLong10294, 207, 2);
         IDirect3DDevice.SetRenderState(this.aLong10294, 208, 2);
      }

   }

   final void method15886(Class329_Sub1 var1) {
      this.method15851(var1);
      if(!this.aBoolArray10302[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, 1);
         this.aBoolArray10302[this.anInt9625] = true;
      }

      if(!this.aBoolArray10312[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, 1);
         this.aBoolArray10312[this.anInt9625] = true;
      }

   }

   void method15074(boolean var1) {
      IDirect3DDevice.method14453(this.aLong10294, 161, var1);
   }

   final void method15887(Class329_Sub1 var1) {
      this.method15851(var1);
      if(!this.aBoolArray10302[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, 1);
         this.aBoolArray10302[this.anInt9625] = true;
      }

      if(!this.aBoolArray10312[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, 1);
         this.aBoolArray10312[this.anInt9625] = true;
      }

   }

   void method15331() {
      if(this.aLong10310 == 0L && this.aClass368Array9717[this.anInt9625] != Class368.aClass368_4615) {
         if(this.aClass368Array9717[this.anInt9625] == Class368.aClass368_4619) {
            IDirect3DDevice.SetTransform(this.aLong10294, 16 + this.anInt9625, this.aClass317Array9716[this.anInt9625].method5642(this.aFloatArray10314));
         } else {
            IDirect3DDevice.SetTransform(this.aLong10294, 16 + this.anInt9625, this.aClass317Array9716[this.anInt9625].method5636(this.aFloatArray10314));
         }

         int var1 = method15862(this.aClass368Array9717[this.anInt9625]);
         if(var1 != this.anIntArray10307[this.anInt9625]) {
            IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 24, var1);
            this.anIntArray10307[this.anInt9625] = var1;
         }
      } else {
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 24, 0);
         this.anIntArray10307[this.anInt9625] = 0;
      }

   }

   final void method15888(Class329_Sub1 var1) {
      this.method15851(var1);
      if(!this.aBoolArray10302[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 1, 1);
         this.aBoolArray10302[this.anInt9625] = true;
      }

      if(!this.aBoolArray10312[this.anInt9625]) {
         IDirect3DDevice.SetSamplerState(this.aLong10294, this.anInt9625, 2, 1);
         this.aBoolArray10312[this.anInt9625] = true;
      }

   }

   static final int method15889(Class367 var0) {
      switch(var0.anInt4614) {
      case 0:
         return 2;
      case 1:
         return 26;
      case 2:
         return 4;
      case 3:
         return 7;
      case 4:
         return 10;
      default:
         throw new IllegalArgumentException();
      }
   }

   static final int method15890(Class367 var0) {
      switch(var0.anInt4614) {
      case 0:
         return 2;
      case 1:
         return 26;
      case 2:
         return 4;
      case 3:
         return 7;
      case 4:
         return 10;
      default:
         throw new IllegalArgumentException();
      }
   }

   static final int method15891(Class351 var0) {
      switch(var0.anInt4459) {
      case 0:
         return 1;
      case 1:
         return 2;
      case 2:
         return 3;
      case 3:
         return 0;
      default:
         throw new IllegalArgumentException();
      }
   }

   static final int method15892(Class351 var0) {
      switch(var0.anInt4459) {
      case 0:
         return 1;
      case 1:
         return 2;
      case 2:
         return 3;
      case 3:
         return 0;
      default:
         throw new IllegalArgumentException();
      }
   }

   public Class85 method11663() {
      D3DADAPTER_IDENTIFIER var1 = new D3DADAPTER_IDENTIFIER();
      IDirect3D.GetAdapterIdentifier(this.aLong10293, this.anInt10291, 0, var1);
      return new Class85(var1.VendorID, "Direct3D", 9, var1.Description, var1.DriverVersion);
   }

   void method15294(boolean var1) {
      IDirect3DDevice.method14453(this.aLong10294, 161, var1);
   }

   static final int method15893(Class368 var0) {
      switch(var0.anInt4621) {
      case 0:
         return 1;
      case 1:
         return 256;
      case 2:
         return 2;
      case 3:
      default:
         return 0;
      case 4:
         return 3;
      case 5:
         return 4;
      }
   }

   final void method15056(int var1, Class351 var2, boolean var3, boolean var4) {
      if(this.aBool9681) {
         int var5 = 0;
         byte var6;
         switch(var1) {
         case 1:
            var6 = 3;
            break;
         case 2:
            var6 = 26;
            break;
         default:
            var6 = 2;
         }

         if(var3) {
            var5 |= 32;
         }

         if(var4) {
            var5 |= 16;
         }

         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, var6, method15872(var2) | var5);
      }

   }

   void method15333() {
      IDirect3DDevice.method14453(this.aLong10294, 15, this.aBool9756);
   }

   final Interface35 method15334(boolean var1) {
      return new Class319(this, var1);
   }

   static final int method15894(Class368 var0) {
      switch(var0.anInt4621) {
      case 0:
         return 1;
      case 1:
         return 256;
      case 2:
         return 2;
      case 3:
      default:
         return 0;
      case 4:
         return 3;
      case 5:
         return 4;
      }
   }

   public final void method15104(Class374 var1, int var2, int var3) {
      if(this.aClass100_Sub1_10309 != null) {
         this.aClass100_Sub1_10309.method13205();
      }

      IDirect3DDevice.DrawPrimitive(this.aLong10294, method15857(var1), var2, var3);
   }

   Class341 method15301(Class348[] var1) {
      return new Class341_Sub1(this, var1);
   }

   void method15150() {
      if(this.aBool9681) {
         int var1 = this.aBoolArray10304[this.anInt9625]?method15853(this.aClass367Array9743[this.anInt9625]):1;
         IDirect3DDevice.SetTextureStageState(this.aLong10294, this.anInt9625, 4, var1);
      }

   }
}
