/* Class87_Sub2_Sub1 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import java.awt.Canvas;

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;

public class Class87_Sub2_Sub1 extends Class87_Sub2
{
    long aLong10885;
    static int[] anIntArray10886;
    long aLong10887 = 0L;
    long aLong10888 = 0L;
    D3DPRESENT_PARAMETERS aD3DPRESENT_PARAMETERS10889;
    boolean aBool10890;
    int anInt10891;
    int anInt10892;
    long aLong10893;
    long aLong10894;
    Class118_Sub2 aClass118_Sub2_10895;
    float[] aFloatArray10896;
    boolean[] aBoolArray10897;
    boolean[] aBoolArray10898;
    boolean aBool10899;
    Class369[] aClass369Array10900;
    int[] anIntArray10901;
    Class276 aClass276_10902;
    Class420 aClass420_10903 = new Class420();
    long aLong10904;
    D3DCAPS aD3DCAPS10905;
    boolean aBool10906;
    boolean[] aBoolArray10907;
    boolean[] aBoolArray10908;
    boolean aBool10909;
    int anInt10910;
    int anInt10911;
    int anInt10912;
    long[] aLongArray10913;
    static int[] anIntArray10914 = { 77, 80 };
    boolean aBool10915;
    
    static final int method17385(Class173 class173, Class90 class90) {
	switch (class90.anInt1046 * -295509) {
	default:
	    break;
	case 0:
	    switch (class173.anInt2137 * -598663847) {
	    case 1:
		return 22;
	    case 4:
		return 21;
	    case 5:
		return Class28.anInt299 * 1217850121;
	    default:
		break;
	    case 2:
		return Class28.anInt298 * 1893612539;
	    case 9:
		return 28;
	    case 7:
		return 77;
	    case 6:
		return 51;
	    case 0:
		return 50;
	    }
	    break;
	case 1:
	    if (class173 == Class173.aClass173_2131)
		return 113;
	    break;
	case 4:
	    if (class173 == Class173.aClass173_2131)
		return 116;
	}
	throw new IllegalArgumentException("");
    }
    
    public boolean method15301() {
	return ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.PixelShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    static Class87 method17386(Canvas canvas, Class106 class106,
			       Interface7 interface7, Class272 class272,
			       Integer integer) {
	Class87_Sub2_Sub1 class87_sub2_sub1 = null;
	Class87_Sub2_Sub1 class87_sub2_sub1_0_;
	try {
	    int i = 0;
	    int i_1_ = 1;
	    long l = IDirect3D.Direct3DCreate();
	    D3DCAPS d3dcaps = new D3DCAPS();
	    IDirect3D.GetDeviceCaps(l, i, i_1_, d3dcaps);
	    if (d3dcaps.MaxSimultaneousTextures < 2)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x8) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x40) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x200) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2000000) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x10) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x20) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if (d3dcaps.MaxActiveLights > 0 && d3dcaps.MaxActiveLights < 2)
		throw new RuntimeException("");
	    if (d3dcaps.MaxStreams < 5)
		throw new RuntimeException("");
	    D3DPRESENT_PARAMETERS d3dpresent_parameters
		= new D3DPRESENT_PARAMETERS(canvas);
	    d3dpresent_parameters.Windowed = true;
	    d3dpresent_parameters.EnableAutoDepthStencil = true;
	    d3dpresent_parameters.BackBufferWidth = canvas.getWidth();
	    d3dpresent_parameters.BackBufferHeight = canvas.getHeight();
	    d3dpresent_parameters.BackBufferCount = 1;
	    d3dpresent_parameters.PresentationInterval = -2147483648;
	    if (!method17401(i, i_1_, l, integer.intValue(),
			     d3dpresent_parameters))
		throw new RuntimeException("");
	    int i_2_ = 0;
	    if ((d3dcaps.DevCaps & 0x100000) != 0)
		i_2_ |= 0x10;
	    long l_3_ = 0L;
	    try {
		l_3_ = IDirect3D.CreateDeviceContext(l, i, i_1_, canvas,
						     i_2_ | 0x40,
						     d3dpresent_parameters);
	    } catch (RuntimeException_Sub1 runtimeexception_sub1) {
		l_3_ = IDirect3D.CreateDeviceContext(l, i, i_1_, canvas,
						     i_2_ & ~0x100000 | 0x20,
						     d3dpresent_parameters);
	    }
	    class87_sub2_sub1
		= new Class87_Sub2_Sub1(i, i_1_, l, l_3_,
					d3dpresent_parameters, d3dcaps,
					class106, interface7, class272,
					integer.intValue());
	    if (!class87_sub2_sub1.aHashtable995.containsKey(canvas)) {
		Class421_Sub23.method14319(canvas, (short) 721);
		class87_sub2_sub1.method2457
		    (canvas,
		     new Class169_Sub1_Sub2_Sub2(class87_sub2_sub1, canvas,
						 canvas.getWidth(),
						 canvas.getHeight(), true),
		     -1875927384);
	    }
	    class87_sub2_sub1.method2098(canvas, (byte) -64);
	    class87_sub2_sub1.method15309();
	    class87_sub2_sub1_0_ = class87_sub2_sub1;
	} catch (RuntimeException runtimeexception) {
	    if (class87_sub2_sub1 != null)
		class87_sub2_sub1.method2080();
	    throw runtimeexception;
	}
	return class87_sub2_sub1_0_;
    }
    
    void method2080() {
	super.method2080();
	if (((Class87_Sub2_Sub1) this).aLong10885 != 0L) {
	    D3DLIGHT.Destroy(((Class87_Sub2_Sub1) this).aLong10885);
	    ((Class87_Sub2_Sub1) this).aLong10885 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10893 != 0L) {
	    D3DLIGHT.Destroy(((Class87_Sub2_Sub1) this).aLong10893);
	    ((Class87_Sub2_Sub1) this).aLong10893 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10894 != 0L) {
	    D3DLIGHT.Destroy(((Class87_Sub2_Sub1) this).aLong10894);
	    ((Class87_Sub2_Sub1) this).aLong10894 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10888 != 0L) {
	    IDirect3DDevice.Destroy(((Class87_Sub2_Sub1) this).aLong10888);
	    ((Class87_Sub2_Sub1) this).aLong10888 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10887 != 0L) {
	    IUnknown.Release(((Class87_Sub2_Sub1) this).aLong10887);
	    ((Class87_Sub2_Sub1) this).aLong10887 = 0L;
	}
    }
    
    void method15313() {
	for (Class243_Sub35 class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7523(-1046362204);
	     class243_sub35 != null;
	     class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7520(-560758849)) {
	    Interface25 interface25
		= (Interface25) class243_sub35.anObject9919;
	    interface25.method174();
	    if (interface25 == aClass169_993)
		interface25.method171();
	}
	super.method15313();
    }
    
    void method15330() {
	for (Class243_Sub35 class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903.method7523(368571935);
	     class243_sub35 != null;
	     class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7520(1388630037)) {
	    Interface25 interface25
		= (Interface25) class243_sub35.anObject9919;
	    interface25.method23();
	}
	super.method15330();
    }
    
    boolean method17387() {
	int i = IDirect3DDevice.TestCooperativeLevel(((Class87_Sub2_Sub1) this)
						     .aLong10888);
	if (i == 0 || i == -2005530519) {
	    IDirect3DDevice.SetDepthStencilSurface((((Class87_Sub2_Sub1) this)
						    .aLong10888),
						   0L);
	    for (int i_4_ = 0; i_4_ < 4; i_4_++)
		IDirect3DDevice.SetRenderTarget((((Class87_Sub2_Sub1) this)
						 .aLong10888),
						i_4_, 0L);
	    for (int i_5_ = 0; i_5_ < 4; i_5_++)
		IDirect3DDevice.SetStreamSource((((Class87_Sub2_Sub1) this)
						 .aLong10888),
						i_5_, 0L, 0, 0);
	    for (int i_6_ = 0; i_6_ < 4; i_6_++)
		IDirect3DDevice.SetTexture((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   i_6_, 0L);
	    IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				       0L);
	    method15330();
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		.BackBufferWidth
		= 0;
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		.BackBufferHeight
		= 0;
	    if (method17401(((Class87_Sub2_Sub1) this).anInt10911,
			    ((Class87_Sub2_Sub1) this).anInt10892,
			    ((Class87_Sub2_Sub1) this).aLong10887, anInt9270,
			    (((Class87_Sub2_Sub1) this)
			     .aD3DPRESENT_PARAMETERS10889))) {
		int i_7_
		    = IDirect3DDevice.Reset((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    (((Class87_Sub2_Sub1) this)
					     .aD3DPRESENT_PARAMETERS10889));
		if (Class31.method992(i_7_)) {
		    method15313();
		    method15598();
		    return true;
		}
		System.exit(0);
	    }
	}
	return false;
    }
    
    void method15598() {
	for (int i = 0; i < anInt9276; i++) {
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 2, 1);
	    ((Class87_Sub2_Sub1) this).aClass369Array10900[i]
		= Class369.aClass369_5543;
	    boolean[] bools = ((Class87_Sub2_Sub1) this).aBoolArray10907;
	    int i_8_ = i;
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[i] = true;
	    bools[i_8_] = true;
	    ((Class87_Sub2_Sub1) this).aBoolArray10908[i] = false;
	    ((Class87_Sub2_Sub1) this).anIntArray10901[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       24, 0);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       145, 1);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 38,
				    0.95F);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       35, 3);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 154,
				    1.0F);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10885, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10893, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10894, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       206, 1);
	((Class87_Sub2_Sub1) this).aBool10890 = false;
	super.method15598();
    }
    
    public Class174 method2075() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class87_Sub2_Sub1) this).aLong10887,
				       ((Class87_Sub2_Sub1) this).anInt10911,
				       0, d3dadapter_identifier);
	return new Class174(d3dadapter_identifier.VendorID,
			    method15302() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion);
    }
    
    static Class87 method17388(Canvas canvas, Class106 class106,
			       Interface7 interface7, Class272 class272,
			       Integer integer) {
	Class87_Sub2_Sub1 class87_sub2_sub1 = null;
	Class87_Sub2_Sub1 class87_sub2_sub1_9_;
	try {
	    int i = 0;
	    int i_10_ = 1;
	    long l = IDirect3D.Direct3DCreate();
	    D3DCAPS d3dcaps = new D3DCAPS();
	    IDirect3D.GetDeviceCaps(l, i, i_10_, d3dcaps);
	    if (d3dcaps.MaxSimultaneousTextures < 2)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x8) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x40) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x200) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2000000) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x10) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x20) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if (d3dcaps.MaxActiveLights > 0 && d3dcaps.MaxActiveLights < 2)
		throw new RuntimeException("");
	    if (d3dcaps.MaxStreams < 5)
		throw new RuntimeException("");
	    D3DPRESENT_PARAMETERS d3dpresent_parameters
		= new D3DPRESENT_PARAMETERS(canvas);
	    d3dpresent_parameters.Windowed = true;
	    d3dpresent_parameters.EnableAutoDepthStencil = true;
	    d3dpresent_parameters.BackBufferWidth = canvas.getWidth();
	    d3dpresent_parameters.BackBufferHeight = canvas.getHeight();
	    d3dpresent_parameters.BackBufferCount = 1;
	    d3dpresent_parameters.PresentationInterval = -2147483648;
	    if (!method17401(i, i_10_, l, integer.intValue(),
			     d3dpresent_parameters))
		throw new RuntimeException("");
	    int i_11_ = 0;
	    if ((d3dcaps.DevCaps & 0x100000) != 0)
		i_11_ |= 0x10;
	    long l_12_ = 0L;
	    try {
		l_12_ = IDirect3D.CreateDeviceContext(l, i, i_10_, canvas,
						      i_11_ | 0x40,
						      d3dpresent_parameters);
	    } catch (RuntimeException_Sub1 runtimeexception_sub1) {
		l_12_ = IDirect3D.CreateDeviceContext(l, i, i_10_, canvas,
						      i_11_ & ~0x100000 | 0x20,
						      d3dpresent_parameters);
	    }
	    class87_sub2_sub1
		= new Class87_Sub2_Sub1(i, i_10_, l, l_12_,
					d3dpresent_parameters, d3dcaps,
					class106, interface7, class272,
					integer.intValue());
	    if (!class87_sub2_sub1.aHashtable995.containsKey(canvas)) {
		Class421_Sub23.method14319(canvas, (short) 721);
		class87_sub2_sub1.method2457
		    (canvas,
		     new Class169_Sub1_Sub2_Sub2(class87_sub2_sub1, canvas,
						 canvas.getWidth(),
						 canvas.getHeight(), true),
		     -1875927384);
	    }
	    class87_sub2_sub1.method2098(canvas, (byte) -57);
	    class87_sub2_sub1.method15309();
	    class87_sub2_sub1_9_ = class87_sub2_sub1;
	} catch (RuntimeException runtimeexception) {
	    if (class87_sub2_sub1 != null)
		class87_sub2_sub1.method2080();
	    throw runtimeexception;
	}
	return class87_sub2_sub1_9_;
    }
    
    public void method2078() {
	long l = IDirect3DDevice
		     .CreateEventQuery(((Class87_Sub2_Sub1) this).aLong10888);
	if (Class31.method992(IDirect3DEventQuery.Issue(l))) {
	    for (;;) {
		int i = IDirect3DEventQuery.IsSignaled(l);
		if (i != 1)
		    break;
		Thread.yield();
	    }
	}
	IUnknown.Release(l);
    }
    
    void method15409() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					137, aBool9298 && !aBool9222);
    }
    
    public void finalize() {
	super.finalize();
    }
    
    public float method15389() {
	return -0.5F;
    }
    
    public Class169_Sub2 method2163() {
	return new Class169_Sub2_Sub3_Sub2(this);
    }
    
    Class169_Sub1 method2102(Canvas canvas, int i, int i_13_) {
	return new Class169_Sub1_Sub2_Sub2(this, canvas, i, i_13_, false);
    }
    
    public Interface5 method2318(int i, int i_14_, Class173 class173,
				 Class90 class90, int i_15_) {
	return new Class257(this, class173, class90, i, i_14_, i_15_);
    }
    
    public final void method15681(Class311 class311, int i, int i_16_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawPrimitive(((Class87_Sub2_Sub1) this).aLong10888,
				      method17403(class311), i, i_16_);
    }
    
    public Interface4 method2251(int i, int i_17_, int i_18_) {
	return new Class345(this, Class90.aClass90_1043, i, i_17_, i_18_);
    }
    
    Class243_Sub35 method17389(Interface25 interface25) {
	for (Class243_Sub35 class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7523(-1482266585);
	     class243_sub35 != null;
	     class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7520(1887849038)) {
	    if (class243_sub35.anObject9919 == interface25)
		return class243_sub35;
	}
	return null;
    }
    
    void method15318() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 27,
				    aBool9282);
    }
    
    void method17390(Interface25 interface25) {
	Class243_Sub35 class243_sub35 = method17389(interface25);
	if (class243_sub35 != null)
	    class243_sub35.method4894(622596470);
    }
    
    final void method17391(long l) {
	((Class87_Sub2_Sub1) this).aLong10904 = l;
	IDirect3DDevice.SetVertexShader(((Class87_Sub2_Sub1) this).aLong10888,
					l);
    }
    
    public boolean method15416() {
	return ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public void method15537(Class367 class367) {
	Class367_Sub2 class367_sub2 = (Class367_Sub2) class367;
	IDirect3DDevice.SetVertexDeclaration((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     (((Class367_Sub2) class367_sub2)
					      .aLong10228));
    }
    
    public void method2117(int i, int i_19_) {
	IDirect3DDevice.Clear(((Class87_Sub2_Sub1) this).aLong10888, i, i_19_,
			      1.0F, 0);
    }
    
    void method17392(Interface25 interface25) {
	Class243_Sub35 class243_sub35 = method17389(interface25);
	if (class243_sub35 != null)
	    class243_sub35.method4894(717815851);
    }
    
    public void method15675(Class367 class367) {
	Class367_Sub2 class367_sub2 = (Class367_Sub2) class367;
	IDirect3DDevice.SetVertexDeclaration((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     (((Class367_Sub2) class367_sub2)
					      .aLong10228));
    }
    
    Interface40 method15455(Class173 class173, int i, int i_20_, boolean bool,
			    float[] fs, int i_21_, int i_22_) {
	return new Class258_Sub1(this, class173, i, i_20_, bool, fs, i_21_,
				 i_22_);
    }
    
    void method15531() {
	IDirect3DDevice.SetScissorRect(((Class87_Sub2_Sub1) this).aLong10888,
				       anInt9149 + anInt9176,
				       anInt9272 + anInt9253, anInt9190,
				       anInt9202);
    }
    
    final void method17393(long l) {
	IDirect3DDevice.SetPixelShader(((Class87_Sub2_Sub1) this).aLong10888,
				       l);
    }
    
    public void method15306(Class276 class276, Class276 class276_23_,
			    Class276 class276_24_) {
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888,
				     256, class276.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 2,
				     class276_23_.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 3,
				     class276_24_.aFloatArray4141);
    }
    
    public void method15350(Class276 class276) {
	class276.method5537(((Class87_Sub2_Sub1) this).aClass276_10902);
    }
    
    void method15615() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					137, aBool9298 && !aBool9222);
    }
    
    void method15360() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 14,
				    aBool9201 && aBool9180);
    }
    
    void method15505() {
	for (int i = 0; i < anInt9276; i++) {
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 2, 1);
	    ((Class87_Sub2_Sub1) this).aClass369Array10900[i]
		= Class369.aClass369_5543;
	    boolean[] bools = ((Class87_Sub2_Sub1) this).aBoolArray10907;
	    int i_25_ = i;
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[i] = true;
	    bools[i_25_] = true;
	    ((Class87_Sub2_Sub1) this).aBoolArray10908[i] = false;
	    ((Class87_Sub2_Sub1) this).anIntArray10901[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       24, 0);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       145, 1);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 38,
				    0.95F);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       35, 3);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 154,
				    1.0F);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10885, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10893, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10894, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       206, 1);
	((Class87_Sub2_Sub1) this).aBool10890 = false;
	super.method15598();
    }
    
    final void method15385(int i, Class385 class385, boolean bool) {
	if (aBool9153) {
	    int i_26_ = 0;
	    int i_27_;
	    switch (i) {
	    default:
		i_27_ = 5;
		break;
	    case 2:
		i_27_ = 27;
		break;
	    case 1:
		i_27_ = 6;
	    }
	    if (bool)
		i_26_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, i_27_,
						 (method17399(class385)
						  | i_26_));
	}
    }
    
    void method15365() {
	if (aBool9153) {
	    float f = aBool9205 ? aFloat9193 : 0.0F;
	    float f_28_ = aBool9205 ? -aFloat9217 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10885,
				f * aFloat9154, f * aFloat9213, f * aFloat9214,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10893,
				f_28_ * aFloat9154, f_28_ * aFloat9213,
				f_28_ * aFloat9214, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15366() {
	if (aBool9153) {
	    D3DLIGHT.SetDirection(((Class87_Sub2_Sub1) this).aLong10885,
				  -aFloatArray9207[0], -aFloatArray9207[1],
				  -aFloatArray9207[2]);
	    D3DLIGHT.SetDirection(((Class87_Sub2_Sub1) this).aLong10893,
				  -aFloatArray9208[0], -aFloatArray9208[1],
				  -aFloatArray9208[2]);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15450() {
	method15365();
	method15367();
    }
    
    Interface45 method15454(Class173 class173, Class90 class90, int i,
			    int i_29_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_29_);
    }
    
    void method15414() {
	int i;
	for (i = 0; i < anInt9220; i++) {
	    Class243_Sub42 class243_sub42 = aClass243_Sub42Array9218[i];
	    int i_30_ = i + 2;
	    int i_31_ = class243_sub42.method16341(-1697616430);
	    float f = class243_sub42.method16337(870433331) / 255.0F;
	    D3DLIGHT.SetPosition(((Class87_Sub2_Sub1) this).aLong10894,
				 (float) class243_sub42
					     .method16334(1141430223),
				 (float) class243_sub42.method16335(490100194),
				 (float) class243_sub42
					     .method16336(-1158629699));
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10894,
				(float) (i_31_ >> 16 & 0xff) * f,
				(float) (i_31_ >> 8 & 0xff) * f,
				(float) (i_31_ & 0xff) * f, 0.0F);
	    D3DLIGHT.SetAttenuation
		(((Class87_Sub2_Sub1) this).aLong10894, 0.0F, 0.0F,
		 1.0F / (float) (class243_sub42.method16345(-117934955)
				 * class243_sub42.method16345(-117934955)));
	    D3DLIGHT.SetRange(((Class87_Sub2_Sub1) this).aLong10894,
			      (float) class243_sub42.method16345(-117934955));
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888,
				     i_30_,
				     ((Class87_Sub2_Sub1) this).aLong10894);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					i_30_, true);
	}
	for (/**/; i < anInt9219; i++)
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					i + 2, false);
    }
    
    final void method17394(long l) {
	((Class87_Sub2_Sub1) this).aLong10904 = l;
	IDirect3DDevice.SetVertexShader(((Class87_Sub2_Sub1) this).aLong10888,
					l);
    }
    
    void method15504() {
	for (int i = 0; i < anInt9276; i++) {
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 2, 1);
	    ((Class87_Sub2_Sub1) this).aClass369Array10900[i]
		= Class369.aClass369_5543;
	    boolean[] bools = ((Class87_Sub2_Sub1) this).aBoolArray10907;
	    int i_32_ = i;
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[i] = true;
	    bools[i_32_] = true;
	    ((Class87_Sub2_Sub1) this).aBoolArray10908[i] = false;
	    ((Class87_Sub2_Sub1) this).anIntArray10901[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       24, 0);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       145, 1);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 38,
				    0.95F);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       35, 3);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 154,
				    1.0F);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10885, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10893, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10894, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       206, 1);
	((Class87_Sub2_Sub1) this).aBool10890 = false;
	super.method15598();
    }
    
    public Class37 method15490(String string) {
	byte[] is = method17430(string);
	if (is == null)
	    return null;
	Class45 class45 = method15305(is);
	return new Class37_Sub1(this, class45);
    }
    
    Interface40 method15376(int i, int i_33_, boolean bool, int[] is,
			    int i_34_, int i_35_) {
	return new Class258_Sub1(this, i, i_33_, bool, is, i_34_, i_35_);
    }
    
    Class367 method15690(Class378[] class378s) {
	return new Class367_Sub2(this, class378s);
    }
    
    Interface40 method15640(Class173 class173, int i, int i_36_, boolean bool,
			    float[] fs, int i_37_, int i_38_) {
	return new Class258_Sub1(this, class173, i, i_36_, bool, fs, i_37_,
				 i_38_);
    }
    
    void method15394() {
	if (aBool9153) {
	    int i = (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]
		     ? method17398(aClass391Array9229[anInt9225]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 1, i);
	}
    }
    
    Interface32 method15377(int i, boolean bool, int[][] is) {
	return new Class258_Sub2(this, i, bool, is);
    }
    
    Interface38 method15378(Class173 class173, int i, int i_39_, int i_40_,
			    boolean bool, byte[] is) {
	return new Class258_Sub3(this, class173, i, i_39_, i_40_, bool, is);
    }
    
    void method15530() {
	if (aClass169_993 != null)
	    IDirect3DDevice.SetViewport(((Class87_Sub2_Sub1) this).aLong10888,
					anInt9149 + anInt9195,
					anInt9272 + anInt9168, anInt9197,
					anInt9198, aFloat9244, aFloat9182);
    }
    
    final void method17395(Class258_Sub1 class258_sub1) {
	method17406(class258_sub1);
	if (((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]
	    != ((Class258_Sub1) class258_sub1).aBool10131) {
	    IDirect3DDevice.SetSamplerState
		(((Class87_Sub2_Sub1) this).aLong10888, anInt9225, 1,
		 ((Class258_Sub1) class258_sub1).aBool10131 ? 1 : 3);
	    ((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]
		= ((Class258_Sub1) class258_sub1).aBool10131;
	}
	if (((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]
	    != ((Class258_Sub1) class258_sub1).aBool10126) {
	    IDirect3DDevice.SetSamplerState
		(((Class87_Sub2_Sub1) this).aLong10888, anInt9225, 2,
		 ((Class258_Sub1) class258_sub1).aBool10126 ? 1 : 3);
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]
		= ((Class258_Sub1) class258_sub1).aBool10126;
	}
    }
    
    final void method17396(Class258_Sub3 class258_sub3) {
	method17406(class258_sub3);
	if (!((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]) {
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    anInt9225, 1, 1);
	    ((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225] = true;
	}
	if (!((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]) {
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    anInt9225, 2, 1);
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225] = true;
	}
    }
    
    public void method15510() {
	if (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]) {
	    ((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225] = false;
	    IDirect3DDevice.SetTexture(((Class87_Sub2_Sub1) this).aLong10888,
				       anInt9225, 0L);
	    method15397();
	    method15394();
	}
    }
    
    void method15392() {
	if (((Class87_Sub2_Sub1) this).aLong10904 == 0L
	    && aClass366Array9228[anInt9225] != Class366.aClass366_5527) {
	    if (aClass366Array9228[anInt9225] == Class366.aClass366_5528)
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5454
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    else
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5481
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    int i = method17413(aClass366Array9228[anInt9225]);
	    if (i != ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225]) {
		IDirect3DDevice.SetTextureStageState(((Class87_Sub2_Sub1)
						      this).aLong10888,
						     anInt9225, 24, i);
		((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = i;
	    }
	} else {
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 24, 0);
	    ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = 0;
	}
    }
    
    void method15393() {
	/* empty */
    }
    
    void method17397(Interface25 interface25) {
	if (method17389(interface25) == null)
	    ((Class87_Sub2_Sub1) this).aClass420_10903
		.method7495(new Class243_Sub35(interface25), -890770303);
    }
    
    void method15397() {
	if (aBool9153) {
	    int i = (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]
		     ? method17398(aClass391Array9206[anInt9225]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 4, i);
	}
    }
    
    public Class37 method15488(String string) {
	byte[] is = method17430(string);
	if (is == null)
	    return null;
	Class45 class45 = method15305(is);
	return new Class37_Sub1(this, class45);
    }
    
    void method15405() {
	aFloat9130 = aFloat9186 - (float) anInt9263;
	aFloat9264 = aFloat9130 - (float) anInt9169;
	if (aFloat9264 < aFloat9185)
	    aFloat9264 = aFloat9185;
	if (aBool9153) {
	    IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888,
					36, aFloat9264);
	    IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888,
					37, aFloat9130);
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   34, anInt9147);
	}
    }
    
    final void method15391() {
	if (aBool9153)
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   60, anInt9231);
    }
    
    static final int method17398(Class391 class391) {
	switch (class391.anInt5690) {
	case 0:
	    return 2;
	case 1:
	    return 10;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 26;
	case 2:
	    return 7;
	case 4:
	    return 4;
	}
    }
    
    static final int method17399(Class385 class385) {
	switch (class385.anInt5639) {
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 0;
	case 2:
	    return 2;
	case 0:
	    return 1;
	case 1:
	    return 3;
	}
    }
    
    Interface40 method15442(Class173 class173, int i, int i_41_, boolean bool,
			    byte[] is, int i_42_, int i_43_) {
	return new Class258_Sub1(this, class173, i, i_41_, bool, is, i_42_,
				 i_43_);
    }
    
    void method15399(int i) {
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       168, i);
    }
    
    static final int method17400(Class385 class385) {
	switch (class385.anInt5639) {
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 0;
	case 2:
	    return 2;
	case 0:
	    return 1;
	case 1:
	    return 3;
	}
    }
    
    void method15401() {
	switch (aClass375_9267.anInt5584) {
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 5);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 6);
	    break;
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 9);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 2);
	    break;
	case 3:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 1);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 2);
	    break;
	}
	switch (anInt9255) {
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 1);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 1);
	    break;
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 2);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 1);
	    break;
	}
    }
    
    void method15406() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					28,
					(aBool9260 && aBool9184
					 && anInt9169 >= 0));
    }
    
    public void method15644(int i, Interface36 interface36) {
	Class263 class263 = (Class263) interface36;
	IDirect3DDevice.SetStreamSource(((Class87_Sub2_Sub1) this).aLong10888,
					i, ((Class263) class263).aLong4054, 0,
					class263.method5162());
    }
    
    static boolean method17401(int i, int i_44_, long l, int i_45_,
			       D3DPRESENT_PARAMETERS d3dpresent_parameters) {
	int i_46_ = 0;
	int i_47_ = 0;
	int i_48_ = 0;
	boolean bool;
	try {
	    D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	    if (Class31.method991
		(IDirect3D.GetAdapterDisplayMode(l, i, d3ddisplaymode)))
		return false;
	while_102_:
	    for (/**/; i_45_ >= 0; i_45_--) {
		if (i_45_ != 1) {
		    i_48_ = 0 + i_45_;
		    for (int i_49_ = 0; i_49_ < anIntArray10886.length;
			 i_49_++) {
			if (IDirect3D.CheckDeviceType(l, i, i_44_,
						      d3ddisplaymode.Format,
						      anIntArray10886[i_49_],
						      true) == 0
			    && IDirect3D.CheckDeviceFormat(l, i, i_44_,
							   (d3ddisplaymode
							    .Format),
							   1, 1,
							   (anIntArray10886
							    [i_49_])) == 0
			    && (i_45_ == 0
				|| (IDirect3D.CheckDeviceMultiSampleType
				    (l, i, i_44_, anIntArray10886[i_49_], true,
				     i_48_)) == 0)) {
			    for (int i_50_ = 0; i_50_ < anIntArray10914.length;
				 i_50_++) {
				if ((IDirect3D.CheckDeviceFormat
				     (l, i, i_44_, d3ddisplaymode.Format, 2, 1,
				      anIntArray10914[i_50_])) == 0
				    && (IDirect3D.CheckDepthStencilMatch
					(l, i, i_44_, d3ddisplaymode.Format,
					 anIntArray10886[i_49_],
					 anIntArray10914[i_50_])) == 0
				    && (i_45_ == 0
					|| (IDirect3D
						.CheckDeviceMultiSampleType
					    (l, i, i_44_,
					     anIntArray10914[i_49_], true,
					     i_48_)) == 0)) {
				    i_47_ = anIntArray10886[i_49_];
				    i_46_ = anIntArray10914[i_50_];
				    break while_102_;
				}
			    }
			}
		    }
		}
	    }
	    if (i_45_ < 0 || i_47_ == 0 || i_46_ == 0)
		return false;
	    d3dpresent_parameters.BackBufferFormat = i_47_;
	    d3dpresent_parameters.AutoDepthStencilFormat = i_46_;
	    d3dpresent_parameters.MultiSampleType = i_48_;
	    d3dpresent_parameters.MultiSampleQuality = 0;
	    bool = true;
	} catch (Throwable throwable) {
	    return false;
	}
	return bool;
    }
    
    void method15461(boolean bool) {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 161,
				    bool);
    }
    
    final Interface31 method15408(boolean bool) {
	return new Class262(this, Class90.aClass90_1042, bool);
    }
    
    final Interface36 method15436(boolean bool) {
	return new Class263(this, bool);
    }
    
    void method15434() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					28,
					(aBool9260 && aBool9184
					 && anInt9169 >= 0));
    }
    
    public void method15411(Class367 class367) {
	Class367_Sub2 class367_sub2 = (Class367_Sub2) class367;
	IDirect3DDevice.SetVertexDeclaration((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     (((Class367_Sub2) class367_sub2)
					      .aLong10228));
    }
    
    Interface40 method15400(Class173 class173, Class90 class90, int i,
			    int i_51_) {
	return new Class258_Sub1(this, class173, class90, i, i_51_);
    }
    
    void method15692(Interface31 interface31) {
	IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				   (((Class262) (Class262) interface31)
				    .aLong4046));
    }
    
    void method15649() {
	if (aBool9153) {
	    int i = (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]
		     ? method17398(aClass391Array9206[anInt9225]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 4, i);
	}
    }
    
    final void method15420(Interface31 interface31, Class311 class311, int i,
			   int i_52_, int i_53_, int i_54_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawIndexedPrimitiveIB((((Class87_Sub2_Sub1) this)
						.aLong10888),
					       ((Class262) (Class262)
						interface31).aLong4046,
					       4, 0, i, i_52_, i_53_, i_54_);
    }
    
    public final void method15421(Class311 class311, int i, int i_55_,
				  int i_56_, int i_57_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawIndexedPrimitive((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     method17403(class311), 0, i,
					     i_55_, i_56_, i_57_);
    }
    
    Class367 method15671(Class378[] class378s) {
	return new Class367_Sub2(this, class378s);
    }
    
    final void method17402(long l) {
	((Class87_Sub2_Sub1) this).aLong10904 = l;
	IDirect3DDevice.SetVertexShader(((Class87_Sub2_Sub1) this).aLong10888,
					l);
    }
    
    public final synchronized void method2081(int i) {
	for (int i_58_ = 0; i_58_ < ((Class87_Sub2_Sub1) this).anInt10912;
	     i_58_++)
	    IUnknown
		.Release(((Class87_Sub2_Sub1) this).aLongArray10913[i_58_]);
	((Class87_Sub2_Sub1) this).anInt10912 = 0;
	super.method2081(i);
    }
    
    void method15699(Interface31 interface31) {
	IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				   (((Class262) (Class262) interface31)
				    .aLong4046));
    }
    
    Interface45 method15610(Class173 class173, Class90 class90, int i,
			    int i_59_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_59_);
    }
    
    static final int method17403(Class311 class311) {
	switch (class311.anInt4594) {
	case 1:
	    return 6;
	case 4:
	    return 4;
	case 3:
	    return 1;
	case 5:
	    return 3;
	case 2:
	    return 2;
	case 0:
	    return 5;
	default:
	    throw new IllegalArgumentException("");
	}
    }
    
    void method15437() {
	if (aBool9153) {
	    D3DLIGHT.SetAmbient(((Class87_Sub2_Sub1) this).aLong10885,
				aFloat9154 * aFloat9145,
				aFloat9213 * aFloat9145,
				aFloat9214 * aFloat9145, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15462() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 174,
				    aBool9175);
    }
    
    synchronized void method17404(long l) {
	if (((Class87_Sub2_Sub1) this).anInt10912
	    == ((Class87_Sub2_Sub1) this).anInt10910) {
	    ((Class87_Sub2_Sub1) this).anInt10910 *= 2;
	    long[] ls = new long[((Class87_Sub2_Sub1) this).anInt10910];
	    System.arraycopy(((Class87_Sub2_Sub1) this).aLongArray10913, 0, ls,
			     0, ((Class87_Sub2_Sub1) this).anInt10912);
	    ((Class87_Sub2_Sub1) this).aLongArray10913 = ls;
	}
	((Class87_Sub2_Sub1) this).aLongArray10913[(((Class87_Sub2_Sub1) this)
						    .anInt10912)]
	    = l;
	((Class87_Sub2_Sub1) this).anInt10912++;
    }
    
    void method15424(int i) {
	if (!((Class87_Sub2_Sub1) this).aBool10909) {
	    int i_60_ = (i & 0x2) != 0 ? 2 : 3;
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   8, i_60_);
	}
    }
    
    static {
	anIntArray10886 = new int[] { 22, 23 };
    }
    
    public Class174 method2322() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class87_Sub2_Sub1) this).aLong10887,
				       ((Class87_Sub2_Sub1) this).anInt10911,
				       0, d3dadapter_identifier);
	return new Class174(d3dadapter_identifier.VendorID,
			    method15302() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion);
    }
    
    public Class174 method2198() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class87_Sub2_Sub1) this).aLong10887,
				       ((Class87_Sub2_Sub1) this).anInt10911,
				       0, d3dadapter_identifier);
	return new Class174(d3dadapter_identifier.VendorID,
			    method15302() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion);
    }
    
    public Class174 method2220() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class87_Sub2_Sub1) this).aLong10887,
				       ((Class87_Sub2_Sub1) this).anInt10911,
				       0, d3dadapter_identifier);
	return new Class174(d3dadapter_identifier.VendorID,
			    method15302() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion);
    }
    
    final void method15624(int i, Class385 class385, boolean bool) {
	if (aBool9153) {
	    int i_61_ = 0;
	    int i_62_;
	    switch (i) {
	    default:
		i_62_ = 5;
		break;
	    case 2:
		i_62_ = 27;
		break;
	    case 1:
		i_62_ = 6;
	    }
	    if (bool)
		i_61_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, i_62_,
						 (method17399(class385)
						  | i_61_));
	}
    }
    
    void method2315(int i, int i_63_) throws Exception_Sub6 {
	IDirect3DDevice.EndScene(((Class87_Sub2_Sub1) this).aLong10888);
	int i_64_ = aClass169_Sub1_976.method15840();
	if (Class31.method991(i_64_)) {
	    if (i_64_ != -2005530520) {
		if (++((Class87_Sub2_Sub1) this).anInt10891 > 50)
		    throw new Exception_Sub6(i_64_);
	    } else {
		aClass169_Sub1_976.method23();
		method17387();
		((Class169_Sub1_Sub2_Sub2) aClass169_Sub1_976).method174();
	    }
	} else
	    ((Class87_Sub2_Sub1) this).anInt10891 = 0;
	IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	if (anInterface7_991 != null)
	    anInterface7_991.method36((byte) 34);
    }
    
    void method2202(int i, int i_65_) throws Exception_Sub6 {
	IDirect3DDevice.EndScene(((Class87_Sub2_Sub1) this).aLong10888);
	int i_66_ = aClass169_Sub1_976.method15840();
	if (Class31.method991(i_66_)) {
	    if (i_66_ != -2005530520) {
		if (++((Class87_Sub2_Sub1) this).anInt10891 > 50)
		    throw new Exception_Sub6(i_66_);
	    } else {
		aClass169_Sub1_976.method23();
		method17387();
		((Class169_Sub1_Sub2_Sub2) aClass169_Sub1_976).method174();
	    }
	} else
	    ((Class87_Sub2_Sub1) this).anInt10891 = 0;
	IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	if (anInterface7_991 != null)
	    anInterface7_991.method36((byte) 10);
    }
    
    void method15594() {
	int i;
	for (i = 0; i < anInt9220; i++) {
	    Class243_Sub42 class243_sub42 = aClass243_Sub42Array9218[i];
	    int i_67_ = i + 2;
	    int i_68_ = class243_sub42.method16341(-869803833);
	    float f = class243_sub42.method16337(-1141366087) / 255.0F;
	    D3DLIGHT.SetPosition(((Class87_Sub2_Sub1) this).aLong10894,
				 (float) class243_sub42
					     .method16334(1141430223),
				 (float) class243_sub42.method16335(490100194),
				 (float) class243_sub42
					     .method16336(-1158629699));
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10894,
				(float) (i_68_ >> 16 & 0xff) * f,
				(float) (i_68_ >> 8 & 0xff) * f,
				(float) (i_68_ & 0xff) * f, 0.0F);
	    D3DLIGHT.SetAttenuation
		(((Class87_Sub2_Sub1) this).aLong10894, 0.0F, 0.0F,
		 1.0F / (float) (class243_sub42.method16345(-117934955)
				 * class243_sub42.method16345(-117934955)));
	    D3DLIGHT.SetRange(((Class87_Sub2_Sub1) this).aLong10894,
			      (float) class243_sub42.method16345(-117934955));
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888,
				     i_67_,
				     ((Class87_Sub2_Sub1) this).aLong10894);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					i_67_, true);
	}
	for (/**/; i < anInt9219; i++)
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					i + 2, false);
    }
    
    void method2390(int i, int i_69_) throws Exception_Sub6 {
	IDirect3DDevice.EndScene(((Class87_Sub2_Sub1) this).aLong10888);
	int i_70_ = aClass169_Sub1_976.method15840();
	if (Class31.method991(i_70_)) {
	    if (i_70_ != -2005530520) {
		if (++((Class87_Sub2_Sub1) this).anInt10891 > 50)
		    throw new Exception_Sub6(i_70_);
	    } else {
		aClass169_Sub1_976.method23();
		method17387();
		((Class169_Sub1_Sub2_Sub2) aClass169_Sub1_976).method174();
	    }
	} else
	    ((Class87_Sub2_Sub1) this).anInt10891 = 0;
	IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	if (anInterface7_991 != null)
	    anInterface7_991.method36((byte) 5);
    }
    
    public Interface5 method2417(int i, int i_71_, Class173 class173,
				 Class90 class90, int i_72_) {
	return new Class257(this, class173, class90, i, i_71_, i_72_);
    }
    
    void method2206() {
	super.method2080();
	if (((Class87_Sub2_Sub1) this).aLong10885 != 0L) {
	    D3DLIGHT.Destroy(((Class87_Sub2_Sub1) this).aLong10885);
	    ((Class87_Sub2_Sub1) this).aLong10885 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10893 != 0L) {
	    D3DLIGHT.Destroy(((Class87_Sub2_Sub1) this).aLong10893);
	    ((Class87_Sub2_Sub1) this).aLong10893 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10894 != 0L) {
	    D3DLIGHT.Destroy(((Class87_Sub2_Sub1) this).aLong10894);
	    ((Class87_Sub2_Sub1) this).aLong10894 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10888 != 0L) {
	    IDirect3DDevice.Destroy(((Class87_Sub2_Sub1) this).aLong10888);
	    ((Class87_Sub2_Sub1) this).aLong10888 = 0L;
	}
	if (((Class87_Sub2_Sub1) this).aLong10887 != 0L) {
	    IUnknown.Release(((Class87_Sub2_Sub1) this).aLong10887);
	    ((Class87_Sub2_Sub1) this).aLong10887 = 0L;
	}
    }
    
    public void method2223(boolean bool) {
	/* empty */
    }
    
    public void method2224(boolean bool) {
	/* empty */
    }
    
    Class169_Sub1 method2297(Canvas canvas, int i, int i_73_) {
	return new Class169_Sub1_Sub2_Sub2(this, canvas, i, i_73_, false);
    }
    
    public int[] method2226(int i, int i_74_, int i_75_, int i_76_) {
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class87_Sub2_Sub1) this).aLong10888, 0);
	long l_77_
	    = IDirect3DDevice.CreateRenderTarget((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 i_75_, i_76_, 21, 0, 0, true);
	if (Class31.method992(IDirect3DDevice.StretchRect(((Class87_Sub2_Sub1)
							   this).aLong10888,
							  l, i, i_74_, i_75_,
							  i_76_, l_77_, 0, 0,
							  i_75_, i_76_, 1))) {
	    is = new int[i_75_ * i_76_];
	    IDirect3DSurface.Download(l_77_, 0, 0, i_75_, i_76_, i_75_ * 4, 16,
				      aLong9140);
	    aByteBuffer9139.clear();
	    aByteBuffer9139.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_77_);
	return is;
    }
    
    void method15581() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 7,
				    aBool9203);
    }
    
    final void method17405(Class258_Sub1 class258_sub1) {
	method17406(class258_sub1);
	if (((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]
	    != ((Class258_Sub1) class258_sub1).aBool10131) {
	    IDirect3DDevice.SetSamplerState
		(((Class87_Sub2_Sub1) this).aLong10888, anInt9225, 1,
		 ((Class258_Sub1) class258_sub1).aBool10131 ? 1 : 3);
	    ((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]
		= ((Class258_Sub1) class258_sub1).aBool10131;
	}
	if (((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]
	    != ((Class258_Sub1) class258_sub1).aBool10126) {
	    IDirect3DDevice.SetSamplerState
		(((Class87_Sub2_Sub1) this).aLong10888, anInt9225, 2,
		 ((Class258_Sub1) class258_sub1).aBool10126 ? 1 : 3);
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]
		= ((Class258_Sub1) class258_sub1).aBool10126;
	}
    }
    
    public void method2249(int i, int i_78_) {
	IDirect3DDevice.Clear(((Class87_Sub2_Sub1) this).aLong10888, i, i_78_,
			      1.0F, 0);
    }
    
    public void method2250(int i, int i_79_) {
	IDirect3DDevice.Clear(((Class87_Sub2_Sub1) this).aLong10888, i, i_79_,
			      1.0F, 0);
    }
    
    void method2077(int i, int i_80_) throws Exception_Sub6 {
	IDirect3DDevice.EndScene(((Class87_Sub2_Sub1) this).aLong10888);
	int i_81_ = aClass169_Sub1_976.method15840();
	if (Class31.method991(i_81_)) {
	    if (i_81_ != -2005530520) {
		if (++((Class87_Sub2_Sub1) this).anInt10891 > 50)
		    throw new Exception_Sub6(i_81_);
	    } else {
		aClass169_Sub1_976.method23();
		method17387();
		((Class169_Sub1_Sub2_Sub2) aClass169_Sub1_976).method174();
	    }
	} else
	    ((Class87_Sub2_Sub1) this).anInt10891 = 0;
	IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	if (anInterface7_991 != null)
	    anInterface7_991.method36((byte) 118);
    }
    
    public Class103 method2214(Class103 class103, Class103 class103_82_,
			       float f, Class103 class103_83_) {
	return f < 0.5F ? class103 : class103_82_;
    }
    
    public Class103 method2352(Class103 class103, Class103 class103_84_,
			       float f, Class103 class103_85_) {
	return f < 0.5F ? class103 : class103_84_;
    }
    
    public void method2108() {
	/* empty */
    }
    
    public Class169_Sub2 method2396() {
	return new Class169_Sub2_Sub3_Sub2(this);
    }
    
    public Interface4 method2385(int i, int i_86_) {
	return new Class345(this, Class90.aClass90_1043, i, i_86_, 0);
    }
    
    void method2342() {
	super.finalize();
    }
    
    public Interface4 method2415(int i, int i_87_, int i_88_) {
	return new Class345(this, Class90.aClass90_1043, i, i_87_, i_88_);
    }
    
    public Interface5 method2416(int i, int i_89_, Class173 class173,
				 Class90 class90, int i_90_) {
	return new Class257(this, class173, class90, i, i_89_, i_90_);
    }
    
    void method15700(Interface31 interface31) {
	IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				   (((Class262) (Class262) interface31)
				    .aLong4046));
    }
    
    public Interface5 method2418(int i, int i_91_, Class173 class173,
				 Class90 class90, int i_92_) {
	return new Class257(this, class173, class90, i, i_91_, i_92_);
    }
    
    public final synchronized void method2419(int i) {
	for (int i_93_ = 0; i_93_ < ((Class87_Sub2_Sub1) this).anInt10912;
	     i_93_++)
	    IUnknown
		.Release(((Class87_Sub2_Sub1) this).aLongArray10913[i_93_]);
	((Class87_Sub2_Sub1) this).anInt10912 = 0;
	super.method2081(i);
    }
    
    public final synchronized void method2132(int i) {
	for (int i_94_ = 0; i_94_ < ((Class87_Sub2_Sub1) this).anInt10912;
	     i_94_++)
	    IUnknown
		.Release(((Class87_Sub2_Sub1) this).aLongArray10913[i_94_]);
	((Class87_Sub2_Sub1) this).anInt10912 = 0;
	super.method2081(i);
    }
    
    public boolean method15601() {
	return ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public boolean method15482() {
	return ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public boolean method15483() {
	return ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.PixelShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public boolean method15484() {
	return ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.PixelShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    void method15658() {
	switch (aClass375_9267.anInt5584) {
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 5);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 6);
	    break;
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 9);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 2);
	    break;
	case 3:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 1);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 2);
	    break;
	}
	switch (anInt9255) {
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 1);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 1);
	    break;
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 2);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 1);
	    break;
	}
    }
    
    public Class37 method15489(String string) {
	byte[] is = method17430(string);
	if (is == null)
	    return null;
	Class45 class45 = method15305(is);
	return new Class37_Sub1(this, class45);
    }
    
    final void method15625(int i, Class385 class385, boolean bool) {
	if (aBool9153) {
	    int i_95_ = 0;
	    int i_96_;
	    switch (i) {
	    default:
		i_96_ = 5;
		break;
	    case 2:
		i_96_ = 27;
		break;
	    case 1:
		i_96_ = 6;
	    }
	    if (bool)
		i_95_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, i_96_,
						 (method17399(class385)
						  | i_95_));
	}
    }
    
    void method15373() {
	if (((Class87_Sub2_Sub1) this).aLong10904 == 0L
	    && aClass366Array9228[anInt9225] != Class366.aClass366_5527) {
	    if (aClass366Array9228[anInt9225] == Class366.aClass366_5528)
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5454
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    else
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5481
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    int i = method17413(aClass366Array9228[anInt9225]);
	    if (i != ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225]) {
		IDirect3DDevice.SetTextureStageState(((Class87_Sub2_Sub1)
						      this).aLong10888,
						     anInt9225, 24, i);
		((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = i;
	    }
	} else {
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 24, 0);
	    ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = 0;
	}
    }
    
    public void method15496(Class276 class276, Class276 class276_97_,
			    Class276 class276_98_) {
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888,
				     256, class276.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 2,
				     class276_97_.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 3,
				     class276_98_.aFloatArray4141);
    }
    
    void method15696(boolean bool) {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 161,
				    bool);
    }
    
    void method15582() {
	for (int i = 0; i < anInt9276; i++) {
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    i, 2, 1);
	    ((Class87_Sub2_Sub1) this).aClass369Array10900[i]
		= Class369.aClass369_5543;
	    boolean[] bools = ((Class87_Sub2_Sub1) this).aBoolArray10907;
	    int i_99_ = i;
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[i] = true;
	    bools[i_99_] = true;
	    ((Class87_Sub2_Sub1) this).aBoolArray10908[i] = false;
	    ((Class87_Sub2_Sub1) this).anIntArray10901[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       24, 0);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       145, 1);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 38,
				    0.95F);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       35, 3);
	IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888, 154,
				    1.0F);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10885, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10893, 3);
	D3DLIGHT.SetType(((Class87_Sub2_Sub1) this).aLong10894, 1);
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       206, 1);
	((Class87_Sub2_Sub1) this).aBool10890 = false;
	super.method15598();
    }
    
    final void method17406(Class258 class258) {
	IDirect3DDevice.SetTexture(((Class87_Sub2_Sub1) this).aLong10888,
				   anInt9225, class258.method5098());
	if (aBool9153
	    && !((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]) {
	    ((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225] = true;
	    method15397();
	    method15394();
	}
    }
    
    byte[] method17407(String string) {
	return method15304("dx", string);
    }
    
    void method15506() {
	for (Class243_Sub35 class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7523(-2043886271);
	     class243_sub35 != null;
	     class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7520(778783728)) {
	    Interface25 interface25
		= (Interface25) class243_sub35.anObject9919;
	    interface25.method23();
	}
	super.method15330();
    }
    
    void method15417() {
	for (Class243_Sub35 class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7523(-840303962);
	     class243_sub35 != null;
	     class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7520(-1576720430)) {
	    Interface25 interface25
		= (Interface25) class243_sub35.anObject9919;
	    interface25.method23();
	}
	super.method15330();
    }
    
    void method15300() {
	for (Class243_Sub35 class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7523(-1420749885);
	     class243_sub35 != null;
	     class243_sub35
		 = (Class243_Sub35) ((Class87_Sub2_Sub1) this)
					.aClass420_10903
					.method7520(1395783438)) {
	    Interface25 interface25
		= (Interface25) class243_sub35.anObject9919;
	    interface25.method174();
	    if (interface25 == aClass169_993)
		interface25.method171();
	}
	super.method15313();
    }
    
    void method15645() {
	/* empty */
    }
    
    public int[] method2242(int i, int i_100_, int i_101_, int i_102_) {
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class87_Sub2_Sub1) this).aLong10888, 0);
	long l_103_
	    = IDirect3DDevice.CreateRenderTarget((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 i_101_, i_102_, 21, 0, 0,
						 true);
	if (Class31.method992(IDirect3DDevice.StretchRect(((Class87_Sub2_Sub1)
							   this).aLong10888,
							  l, i, i_100_, i_101_,
							  i_102_, l_103_, 0, 0,
							  i_101_, i_102_,
							  1))) {
	    is = new int[i_101_ * i_102_];
	    IDirect3DSurface.Download(l_103_, 0, 0, i_101_, i_102_, i_101_ * 4,
				      16, aLong9140);
	    aByteBuffer9139.clear();
	    aByteBuffer9139.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_103_);
	return is;
    }
    
    void method15338() {
	if (aClass169_993 != null)
	    IDirect3DDevice.SetViewport(((Class87_Sub2_Sub1) this).aLong10888,
					anInt9149 + anInt9195,
					anInt9272 + anInt9168, anInt9197,
					anInt9198, aFloat9244, aFloat9182);
    }
    
    boolean method15371(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 3,
				      method17409(class173, class90))));
    }
    
    void method15532() {
	IDirect3DDevice.SetScissorRect(((Class87_Sub2_Sub1) this).aLong10888,
				       anInt9149 + anInt9176,
				       anInt9272 + anInt9253, anInt9190,
				       anInt9202);
    }
    
    public void method15413(Class276 class276) {
	class276.method5537(((Class87_Sub2_Sub1) this).aClass276_10902);
    }
    
    public void method15555(Class276 class276) {
	class276.method5537(((Class87_Sub2_Sub1) this).aClass276_10902);
    }
    
    void method15576() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 7,
				    aBool9203);
    }
    
    static final int method17408(Class391 class391) {
	switch (class391.anInt5690) {
	case 0:
	    return 2;
	case 1:
	    return 10;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 26;
	case 2:
	    return 7;
	case 4:
	    return 4;
	}
    }
    
    void method15375() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 7,
				    aBool9203);
    }
    
    void method15334() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 14,
				    aBool9201 && aBool9180);
    }
    
    void method15677() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					137, aBool9298 && !aBool9222);
    }
    
    public float method15466() {
	return -0.5F;
    }
    
    void method15529() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					137, aBool9298 && !aBool9222);
    }
    
    void method15697(Interface31 interface31) {
	IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				   (((Class262) (Class262) interface31)
				    .aLong4046));
    }
    
    void method15694(boolean bool) {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 161,
				    bool);
    }
    
    void method15583() {
	if (aBool9153) {
	    D3DLIGHT.SetAmbient(((Class87_Sub2_Sub1) this).aLong10885,
				aFloat9154 * aFloat9145,
				aFloat9213 * aFloat9145,
				aFloat9214 * aFloat9145, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    final void method15683(Interface31 interface31, Class311 class311, int i,
			   int i_104_, int i_105_, int i_106_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawIndexedPrimitiveIB
	    (((Class87_Sub2_Sub1) this).aLong10888,
	     ((Class262) (Class262) interface31).aLong4046, 4, 0, i, i_104_,
	     i_105_, i_106_);
    }
    
    void method15481() {
	if (aBool9153) {
	    float f = aBool9205 ? aFloat9193 : 0.0F;
	    float f_107_ = aBool9205 ? -aFloat9217 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10885,
				f * aFloat9154, f * aFloat9213, f * aFloat9214,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10893,
				f_107_ * aFloat9154, f_107_ * aFloat9213,
				f_107_ * aFloat9214, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15564() {
	if (aBool9153) {
	    float f = aBool9205 ? aFloat9193 : 0.0F;
	    float f_108_ = aBool9205 ? -aFloat9217 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10885,
				f * aFloat9154, f * aFloat9213, f * aFloat9214,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10893,
				f_108_ * aFloat9154, f_108_ * aFloat9213,
				f_108_ * aFloat9214, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15586() {
	if (aBool9153) {
	    float f = aBool9205 ? aFloat9193 : 0.0F;
	    float f_109_ = aBool9205 ? -aFloat9217 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10885,
				f * aFloat9154, f * aFloat9213, f * aFloat9214,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10893,
				f_109_ * aFloat9154, f_109_ * aFloat9213,
				f_109_ * aFloat9214, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15587() {
	if (aBool9153) {
	    D3DLIGHT.SetDirection(((Class87_Sub2_Sub1) this).aLong10885,
				  -aFloatArray9207[0], -aFloatArray9207[1],
				  -aFloatArray9207[2]);
	    D3DLIGHT.SetDirection(((Class87_Sub2_Sub1) this).aLong10893,
				  -aFloatArray9208[0], -aFloatArray9208[1],
				  -aFloatArray9208[2]);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    void method15588() {
	if (aBool9153 && !((Class87_Sub2_Sub1) this).aBool10890) {
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					0, false);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					1, false);
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888, 0,
				     ((Class87_Sub2_Sub1) this).aLong10885);
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888, 1,
				     ((Class87_Sub2_Sub1) this).aLong10893);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					0, true);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					1, true);
	    ((Class87_Sub2_Sub1) this).aBool10890 = true;
	}
    }
    
    void method15589() {
	method15365();
	method15367();
    }
    
    void method15577() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 14,
				    aBool9201 && aBool9180);
    }
    
    public void method15676(Class367 class367) {
	Class367_Sub2 class367_sub2 = (Class367_Sub2) class367;
	IDirect3DDevice.SetVertexDeclaration((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     (((Class367_Sub2) class367_sub2)
					      .aLong10228));
    }
    
    boolean method15596(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 4,
				      method17409(class173, class90))));
    }
    
    boolean method15327(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 4,
				      method17409(class173, class90))));
    }
    
    void method15657(int i) {
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       168, i);
    }
    
    static final int method17409(Class173 class173, Class90 class90) {
	switch (class90.anInt1046 * -295509) {
	default:
	    break;
	case 0:
	    switch (class173.anInt2137 * -598663847) {
	    case 1:
		return 22;
	    case 4:
		return 21;
	    case 5:
		return Class28.anInt299 * 1217850121;
	    default:
		break;
	    case 2:
		return Class28.anInt298 * 1893612539;
	    case 9:
		return 28;
	    case 7:
		return 77;
	    case 6:
		return 51;
	    case 0:
		return 50;
	    }
	    break;
	case 1:
	    if (class173 == Class173.aClass173_2131)
		return 113;
	    break;
	case 4:
	    if (class173 == Class173.aClass173_2131)
		return 116;
	}
	throw new IllegalArgumentException("");
    }
    
    Interface40 method15603(Class173 class173, Class90 class90, int i,
			    int i_110_) {
	return new Class258_Sub1(this, class173, class90, i, i_110_);
    }
    
    Interface40 method15672(Class173 class173, Class90 class90, int i,
			    int i_111_) {
	return new Class258_Sub1(this, class173, class90, i, i_111_);
    }
    
    public void method2364(int i, int i_112_) {
	IDirect3DDevice.Clear(((Class87_Sub2_Sub1) this).aLong10888, i, i_112_,
			      1.0F, 0);
    }
    
    Interface40 method15605(Class173 class173, int i, int i_113_, boolean bool,
			    byte[] is, int i_114_, int i_115_) {
	return new Class258_Sub1(this, class173, i, i_113_, bool, is, i_114_,
				 i_115_);
    }
    
    Interface40 method15321(int i, int i_116_, boolean bool, int[] is,
			    int i_117_, int i_118_) {
	return new Class258_Sub1(this, i, i_116_, bool, is, i_117_, i_118_);
    }
    
    Interface40 method15633(int i, int i_119_, boolean bool, int[] is,
			    int i_120_, int i_121_) {
	return new Class258_Sub1(this, i, i_119_, bool, is, i_120_, i_121_);
    }
    
    Interface32 method15608(int i, boolean bool, int[][] is) {
	return new Class258_Sub2(this, i, bool, is);
    }
    
    Interface32 method15464(int i, boolean bool, int[][] is) {
	return new Class258_Sub2(this, i, bool, is);
    }
    
    public void method2227() {
	/* empty */
    }
    
    Interface45 method15609(Class173 class173, Class90 class90, int i,
			    int i_122_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_122_);
    }
    
    Interface45 method15432(Class173 class173, Class90 class90, int i,
			    int i_123_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_123_);
    }
    
    Interface40 method15602(Class173 class173, Class90 class90, int i,
			    int i_124_) {
	return new Class258_Sub1(this, class173, class90, i, i_124_);
    }
    
    Interface45 method15611(Class173 class173, Class90 class90, int i,
			    int i_125_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_125_);
    }
    
    Interface45 method15317(Class173 class173, Class90 class90, int i,
			    int i_126_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_126_);
    }
    
    public void method15612() {
	if (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]) {
	    ((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225] = false;
	    IDirect3DDevice.SetTexture(((Class87_Sub2_Sub1) this).aLong10888,
				       anInt9225, 0L);
	    method15397();
	    method15394();
	}
    }
    
    void method15340() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 174,
				    aBool9175);
    }
    
    Interface40 method15337(Class173 class173, Class90 class90, int i,
			    int i_127_) {
	return new Class258_Sub1(this, class173, class90, i, i_127_);
    }
    
    Interface40 method15441(Class173 class173, Class90 class90, int i,
			    int i_128_) {
	return new Class258_Sub1(this, class173, class90, i, i_128_);
    }
    
    void method15660() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 27,
				    aBool9282);
    }
    
    public Class37 method15303(String string) {
	byte[] is = method17430(string);
	if (is == null)
	    return null;
	Class45 class45 = method15305(is);
	return new Class37_Sub1(this, class45);
    }
    
    final void method15449() {
	if (aBool9153)
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   60, anInt9231);
    }
    
    final void method15465() {
	if (aBool9153)
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   60, anInt9231);
    }
    
    final void method15641() {
	if (aBool9153)
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   60, anInt9231);
    }
    
    void method15642() {
	if (((Class87_Sub2_Sub1) this).aLong10904 == 0L
	    && aClass366Array9228[anInt9225] != Class366.aClass366_5527) {
	    if (aClass366Array9228[anInt9225] == Class366.aClass366_5528)
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5454
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    else
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5481
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    int i = method17413(aClass366Array9228[anInt9225]);
	    if (i != ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225]) {
		IDirect3DDevice.SetTextureStageState(((Class87_Sub2_Sub1)
						      this).aLong10888,
						     anInt9225, 24, i);
		((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = i;
	    }
	} else {
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 24, 0);
	    ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = 0;
	}
    }
    
    Class87_Sub2_Sub1(int i, int i_129_, long l, long l_130_,
		      D3DPRESENT_PARAMETERS d3dpresent_parameters,
		      D3DCAPS d3dcaps, Class106 class106,
		      Interface7 interface7, Class272 class272, int i_131_) {
	super(class106, interface7, class272, i_131_, 0);
	((Class87_Sub2_Sub1) this).anInt10891 = 0;
	((Class87_Sub2_Sub1) this).aLong10885 = 0L;
	((Class87_Sub2_Sub1) this).aLong10893 = 0L;
	((Class87_Sub2_Sub1) this).aLong10894 = 0L;
	((Class87_Sub2_Sub1) this).aBool10890 = false;
	((Class87_Sub2_Sub1) this).aFloatArray10896 = new float[16];
	((Class87_Sub2_Sub1) this).anInt10910 = 128;
	((Class87_Sub2_Sub1) this).anInt10912 = 0;
	((Class87_Sub2_Sub1) this).aLongArray10913
	    = new long[((Class87_Sub2_Sub1) this).anInt10910];
	try {
	    ((Class87_Sub2_Sub1) this).anInt10911 = i;
	    ((Class87_Sub2_Sub1) this).anInt10892 = i_129_;
	    ((Class87_Sub2_Sub1) this).aLong10887 = l;
	    ((Class87_Sub2_Sub1) this).aLong10888 = l_130_;
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		= d3dpresent_parameters;
	    ((Class87_Sub2_Sub1) this).aD3DCAPS10905 = d3dcaps;
	    ((Class87_Sub2_Sub1) this).aLong10885 = D3DLIGHT.Create();
	    ((Class87_Sub2_Sub1) this).aLong10893 = D3DLIGHT.Create();
	    ((Class87_Sub2_Sub1) this).aLong10894 = D3DLIGHT.Create();
	    anInt9276 = (((Class87_Sub2_Sub1) this).aD3DCAPS10905
			 .MaxSimultaneousTextures);
	    anInt9277
		= (((Class87_Sub2_Sub1) this).aD3DCAPS10905.MaxActiveLights > 0
		   ? ((Class87_Sub2_Sub1) this).aD3DCAPS10905.MaxActiveLights
		   : 8);
	    ((Class87_Sub2_Sub1) this).aBool10906
		= ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.TextureCaps & 0x2)
		   == 0);
	    aBool9163 = (((Class87_Sub2_Sub1) this).aD3DCAPS10905.TextureCaps
			 & 0x2000) != 0;
	    ((Class87_Sub2_Sub1) this).aBool10915
		= (((Class87_Sub2_Sub1) this).aD3DCAPS10905.TextureCaps
		   & 0x10000) != 0;
	    ((Class87_Sub2_Sub1) this).aBool10899
		= (((Class87_Sub2_Sub1) this).aD3DCAPS10905.TextureCaps
		   & 0x4000) != 0;
	    aBool9278
		= (((Class87_Sub2_Sub1) this).aD3DCAPS10905.NumSimultaneousRTs
		   > 0);
	    aBool9279
		= (((Class87_Sub2_Sub1) this).aD3DCAPS10905.NumSimultaneousRTs
		   > 0);
	    aBool9281
		= anInt9270 > 0 || (IDirect3D.CheckDeviceMultiSampleType
				    (((Class87_Sub2_Sub1) this).aLong10887,
				     ((Class87_Sub2_Sub1) this).anInt10911,
				     ((Class87_Sub2_Sub1) this).anInt10892,
				     (((Class87_Sub2_Sub1) this)
				      .aD3DPRESENT_PARAMETERS10889
				      .BackBufferFormat),
				     true, 2)) == 0;
	    aBool9178
		= ((((Class87_Sub2_Sub1) this).aD3DCAPS10905.NumSimultaneousRTs
		    > 0) && anInt9270 > 0
		   || ((IDirect3D.CheckDeviceMultiSampleType
			(((Class87_Sub2_Sub1) this).aLong10887,
			 ((Class87_Sub2_Sub1) this).anInt10911,
			 ((Class87_Sub2_Sub1) this).anInt10892, 113, true, 2))
		       == 0));
	    ((Class87_Sub2_Sub1) this).aBoolArray10907
		= new boolean[anInt9276];
	    ((Class87_Sub2_Sub1) this).aBoolArray10897
		= new boolean[anInt9276];
	    ((Class87_Sub2_Sub1) this).aBoolArray10898
		= new boolean[anInt9276];
	    ((Class87_Sub2_Sub1) this).aClass369Array10900
		= new Class369[anInt9276];
	    ((Class87_Sub2_Sub1) this).aBoolArray10908
		= new boolean[anInt9276];
	    ((Class87_Sub2_Sub1) this).anIntArray10901 = new int[anInt9276];
	    Class350 class350 = new Class350();
	    class350.method6566(1.0F, -1.0F, 0.5F);
	    class350.method6564(0.0F, 0.0F, 0.5F);
	    ((Class87_Sub2_Sub1) this).aClass276_10902 = new Class276();
	    ((Class87_Sub2_Sub1) this).aClass276_10902.method5513(class350);
	    IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	} catch (Throwable throwable) {
	    throwable.printStackTrace();
	    method2240(237792179);
	    throw new RuntimeException("");
	}
    }
    
    Class367 method15410(Class378[] class378s) {
	return new Class367_Sub2(this, class378s);
    }
    
    public void method2127() {
	long l = IDirect3DDevice
		     .CreateEventQuery(((Class87_Sub2_Sub1) this).aLong10888);
	if (Class31.method992(IDirect3DEventQuery.Issue(l))) {
	    for (;;) {
		int i = IDirect3DEventQuery.IsSignaled(l);
		if (i != 1)
		    break;
		Thread.yield();
	    }
	}
	IUnknown.Release(l);
    }
    
    void method15646() {
	/* empty */
    }
    
    void method15647() {
	if (aBool9153) {
	    int i = (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]
		     ? method17398(aClass391Array9229[anInt9225]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 1, i);
	}
    }
    
    void method15359() {
	if (aBool9153) {
	    int i = (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]
		     ? method17398(aClass391Array9206[anInt9225]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 4, i);
	}
    }
    
    void method15648() {
	if (aBool9153) {
	    int i = (((Class87_Sub2_Sub1) this).aBoolArray10898[anInt9225]
		     ? method17398(aClass391Array9206[anInt9225]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 4, i);
	}
    }
    
    final void method17410(long l) {
	((Class87_Sub2_Sub1) this).aLong10904 = l;
	IDirect3DDevice.SetVertexShader(((Class87_Sub2_Sub1) this).aLong10888,
					l);
    }
    
    void method15652(int i) {
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       168, i);
    }
    
    void method15653(int i) {
	IDirect3DDevice.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888,
				       168, i);
    }
    
    final Interface31 method15666(boolean bool) {
	return new Class262(this, Class90.aClass90_1042, bool);
    }
    
    void method15520() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 15,
				    aBool9269);
    }
    
    void method15655() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 15,
				    aBool9269);
    }
    
    void method15656() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 15,
				    aBool9269);
    }
    
    void method15460() {
	switch (aClass375_9267.anInt5584) {
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 5);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 6);
	    break;
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 9);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 2);
	    break;
	case 3:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 1);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 20, 2);
	    break;
	}
	switch (anInt9255) {
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 1);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 1);
	    break;
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 2);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 207, 2);
	    IDirect3DDevice
		.SetRenderState(((Class87_Sub2_Sub1) this).aLong10888, 208, 1);
	    break;
	}
    }
    
    public final void method15419(Class311 class311, int i, int i_132_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawPrimitive(((Class87_Sub2_Sub1) this).aLong10888,
				      method17403(class311), i, i_132_);
    }
    
    void method15659() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 27,
				    aBool9282);
    }
    
    final void method15621(int i, Class385 class385, boolean bool,
			   boolean bool_133_) {
	if (aBool9153) {
	    int i_134_ = 0;
	    int i_135_;
	    switch (i) {
	    case 2:
		i_135_ = 26;
		break;
	    default:
		i_135_ = 2;
		break;
	    case 1:
		i_135_ = 3;
	    }
	    if (bool)
		i_134_ |= 0x20;
	    if (bool_133_)
		i_134_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, i_135_,
						 (method17399(class385)
						  | i_134_));
	}
    }
    
    void method15663() {
	aFloat9130 = aFloat9186 - (float) anInt9263;
	aFloat9264 = aFloat9130 - (float) anInt9169;
	if (aFloat9264 < aFloat9185)
	    aFloat9264 = aFloat9185;
	if (aBool9153) {
	    IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888,
					36, aFloat9264);
	    IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888,
					37, aFloat9130);
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   34, anInt9147);
	}
    }
    
    void method15664() {
	aFloat9130 = aFloat9186 - (float) anInt9263;
	aFloat9264 = aFloat9130 - (float) anInt9169;
	if (aFloat9264 < aFloat9185)
	    aFloat9264 = aFloat9185;
	if (aBool9153) {
	    IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888,
					36, aFloat9264);
	    IDirect3DDevice.method16773(((Class87_Sub2_Sub1) this).aLong10888,
					37, aFloat9130);
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   34, anInt9147);
	}
    }
    
    void method15665() {
	if (aBool9153)
	    IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888,
					28,
					(aBool9260 && aBool9184
					 && anInt9169 >= 0));
    }
    
    public void method15412(int i, Interface36 interface36) {
	Class263 class263 = (Class263) interface36;
	IDirect3DDevice.SetStreamSource(((Class87_Sub2_Sub1) this).aLong10888,
					i, ((Class263) class263).aLong4054, 0,
					class263.method5162());
    }
    
    public void method2196(boolean bool) {
	/* empty */
    }
    
    final Interface31 method15604(boolean bool) {
	return new Class262(this, Class90.aClass90_1042, bool);
    }
    
    final Interface31 method15667(boolean bool) {
	return new Class262(this, Class90.aClass90_1042, bool);
    }
    
    final Interface36 method15668(boolean bool) {
	return new Class263(this, bool);
    }
    
    final Interface36 method15669(boolean bool) {
	return new Class263(this, bool);
    }
    
    final Interface36 method15670(boolean bool) {
	return new Class263(this, bool);
    }
    
    void method2203(int i, int i_136_) throws Exception_Sub6 {
	IDirect3DDevice.EndScene(((Class87_Sub2_Sub1) this).aLong10888);
	int i_137_ = aClass169_Sub1_976.method15840();
	if (Class31.method991(i_137_)) {
	    if (i_137_ != -2005530520) {
		if (++((Class87_Sub2_Sub1) this).anInt10891 > 50)
		    throw new Exception_Sub6(i_137_);
	    } else {
		aClass169_Sub1_976.method23();
		method17387();
		((Class169_Sub1_Sub2_Sub2) aClass169_Sub1_976).method174();
	    }
	} else
	    ((Class87_Sub2_Sub1) this).anInt10891 = 0;
	IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	if (anInterface7_991 != null)
	    anInterface7_991.method36((byte) 93);
    }
    
    static final int method17411(Class173 class173, Class90 class90) {
	switch (class90.anInt1046 * -295509) {
	default:
	    break;
	case 0:
	    switch (class173.anInt2137 * -598663847) {
	    case 1:
		return 22;
	    case 4:
		return 21;
	    case 5:
		return Class28.anInt299 * 1217850121;
	    default:
		break;
	    case 2:
		return Class28.anInt298 * 1893612539;
	    case 9:
		return 28;
	    case 7:
		return 77;
	    case 6:
		return 51;
	    case 0:
		return 50;
	    }
	    break;
	case 1:
	    if (class173 == Class173.aClass173_2131)
		return 113;
	    break;
	case 4:
	    if (class173 == Class173.aClass173_2131)
		return 116;
	}
	throw new IllegalArgumentException("");
    }
    
    void method2146(int i, int i_138_) throws Exception_Sub6 {
	IDirect3DDevice.EndScene(((Class87_Sub2_Sub1) this).aLong10888);
	int i_139_ = aClass169_Sub1_976.method15840();
	if (Class31.method991(i_139_)) {
	    if (i_139_ != -2005530520) {
		if (++((Class87_Sub2_Sub1) this).anInt10891 > 50)
		    throw new Exception_Sub6(i_139_);
	    } else {
		aClass169_Sub1_976.method23();
		method17387();
		((Class169_Sub1_Sub2_Sub2) aClass169_Sub1_976).method174();
	    }
	} else
	    ((Class87_Sub2_Sub1) this).anInt10891 = 0;
	IDirect3DDevice.BeginScene(((Class87_Sub2_Sub1) this).aLong10888);
	if (anInterface7_991 != null)
	    anInterface7_991.method36((byte) 78);
    }
    
    public void method15574(Class367 class367) {
	Class367_Sub2 class367_sub2 = (Class367_Sub2) class367;
	IDirect3DDevice.SetVertexDeclaration((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     (((Class367_Sub2) class367_sub2)
					      .aLong10228));
    }
    
    void method15367() {
	if (aBool9153 && !((Class87_Sub2_Sub1) this).aBool10890) {
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					0, false);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					1, false);
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888, 0,
				     ((Class87_Sub2_Sub1) this).aLong10885);
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888, 1,
				     ((Class87_Sub2_Sub1) this).aLong10893);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					0, true);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					1, true);
	    ((Class87_Sub2_Sub1) this).aBool10890 = true;
	}
    }
    
    public void method15312(Class367 class367) {
	Class367_Sub2 class367_sub2 = (Class367_Sub2) class367;
	IDirect3DDevice.SetVertexDeclaration((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     (((Class367_Sub2) class367_sub2)
					      .aLong10228));
    }
    
    static final int method17412(Class90 class90) {
	if (class90 == Class90.aClass90_1042)
	    return 80;
	if (class90 == Class90.aClass90_1043)
	    return 77;
	throw new IllegalArgumentException("");
    }
    
    boolean method15372(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 4,
				      method17409(class173, class90))));
    }
    
    public void method15678(int i, Interface36 interface36) {
	Class263 class263 = (Class263) interface36;
	IDirect3DDevice.SetStreamSource(((Class87_Sub2_Sub1) this).aLong10888,
					i, ((Class263) class263).aLong4054, 0,
					class263.method5162());
    }
    
    static final int method17413(Class366 class366) {
	switch (class366.anInt5526) {
	case 4:
	    return 256;
	case 2:
	    return 4;
	case 1:
	    return 3;
	case 3:
	    return 1;
	case 5:
	    return 2;
	default:
	    return 0;
	}
    }
    
    public final void method15440(Class311 class311, int i, int i_140_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawPrimitive(((Class87_Sub2_Sub1) this).aLong10888,
				      method17403(class311), i, i_140_);
    }
    
    public final void method15324(Class311 class311, int i, int i_141_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawPrimitive(((Class87_Sub2_Sub1) this).aLong10888,
				      method17403(class311), i, i_141_);
    }
    
    public Class103 method2218(Class103 class103, Class103 class103_142_,
			       float f, Class103 class103_143_) {
	return f < 0.5F ? class103 : class103_142_;
    }
    
    public final void method15684(Class311 class311, int i, int i_144_,
				  int i_145_, int i_146_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawIndexedPrimitive((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     method17403(class311), 0, i,
					     i_144_, i_145_, i_146_);
    }
    
    public final void method15415(Class311 class311, int i, int i_147_,
				  int i_148_, int i_149_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawIndexedPrimitive((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     method17403(class311), 0, i,
					     i_147_, i_148_, i_149_);
    }
    
    public final void method15503(Class311 class311, int i, int i_150_,
				  int i_151_, int i_152_) {
	if (((Class87_Sub2_Sub1) this).aClass118_Sub2_10895 != null)
	    ((Class87_Sub2_Sub1) this).aClass118_Sub2_10895.method16720();
	IDirect3DDevice.DrawIndexedPrimitive((((Class87_Sub2_Sub1) this)
					      .aLong10888),
					     method17403(class311), 0, i,
					     i_150_, i_151_, i_152_);
    }
    
    static Class87 method17414(Canvas canvas, Class106 class106,
			       Interface7 interface7, Class272 class272,
			       Integer integer) {
	Class87_Sub2_Sub1 class87_sub2_sub1 = null;
	Class87_Sub2_Sub1 class87_sub2_sub1_153_;
	try {
	    int i = 0;
	    int i_154_ = 1;
	    long l = IDirect3D.Direct3DCreate();
	    D3DCAPS d3dcaps = new D3DCAPS();
	    IDirect3D.GetDeviceCaps(l, i, i_154_, d3dcaps);
	    if (d3dcaps.MaxSimultaneousTextures < 2)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x8) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x40) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x200) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2000000) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x10) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x20) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if (d3dcaps.MaxActiveLights > 0 && d3dcaps.MaxActiveLights < 2)
		throw new RuntimeException("");
	    if (d3dcaps.MaxStreams < 5)
		throw new RuntimeException("");
	    D3DPRESENT_PARAMETERS d3dpresent_parameters
		= new D3DPRESENT_PARAMETERS(canvas);
	    d3dpresent_parameters.Windowed = true;
	    d3dpresent_parameters.EnableAutoDepthStencil = true;
	    d3dpresent_parameters.BackBufferWidth = canvas.getWidth();
	    d3dpresent_parameters.BackBufferHeight = canvas.getHeight();
	    d3dpresent_parameters.BackBufferCount = 1;
	    d3dpresent_parameters.PresentationInterval = -2147483648;
	    if (!method17401(i, i_154_, l, integer.intValue(),
			     d3dpresent_parameters))
		throw new RuntimeException("");
	    int i_155_ = 0;
	    if ((d3dcaps.DevCaps & 0x100000) != 0)
		i_155_ |= 0x10;
	    long l_156_ = 0L;
	    try {
		l_156_ = IDirect3D.CreateDeviceContext(l, i, i_154_, canvas,
						       i_155_ | 0x40,
						       d3dpresent_parameters);
	    } catch (RuntimeException_Sub1 runtimeexception_sub1) {
		l_156_
		    = IDirect3D.CreateDeviceContext(l, i, i_154_, canvas,
						    i_155_ & ~0x100000 | 0x20,
						    d3dpresent_parameters);
	    }
	    class87_sub2_sub1
		= new Class87_Sub2_Sub1(i, i_154_, l, l_156_,
					d3dpresent_parameters, d3dcaps,
					class106, interface7, class272,
					integer.intValue());
	    if (!class87_sub2_sub1.aHashtable995.containsKey(canvas)) {
		Class421_Sub23.method14319(canvas, (short) 721);
		class87_sub2_sub1.method2457
		    (canvas,
		     new Class169_Sub1_Sub2_Sub2(class87_sub2_sub1, canvas,
						 canvas.getWidth(),
						 canvas.getHeight(), true),
		     -1875927384);
	    }
	    class87_sub2_sub1.method2098(canvas, (byte) -32);
	    class87_sub2_sub1.method15309();
	    class87_sub2_sub1_153_ = class87_sub2_sub1;
	} catch (RuntimeException runtimeexception) {
	    if (class87_sub2_sub1 != null)
		class87_sub2_sub1.method2080();
	    throw runtimeexception;
	}
	return class87_sub2_sub1_153_;
    }
    
    static Class87 method17415(Canvas canvas, Class106 class106,
			       Interface7 interface7, Class272 class272,
			       Integer integer) {
	Class87_Sub2_Sub1 class87_sub2_sub1 = null;
	Class87_Sub2_Sub1 class87_sub2_sub1_157_;
	try {
	    int i = 0;
	    int i_158_ = 1;
	    long l = IDirect3D.Direct3DCreate();
	    D3DCAPS d3dcaps = new D3DCAPS();
	    IDirect3D.GetDeviceCaps(l, i, i_158_, d3dcaps);
	    if (d3dcaps.MaxSimultaneousTextures < 2)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x8) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x40) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x200) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.TextureOpCaps & 0x2000000) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x10) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x20) == 0)
		throw new RuntimeException("");
	    if ((d3dcaps.SrcBlendCaps & d3dcaps.DestBlendCaps & 0x2) == 0)
		throw new RuntimeException("");
	    if (d3dcaps.MaxActiveLights > 0 && d3dcaps.MaxActiveLights < 2)
		throw new RuntimeException("");
	    if (d3dcaps.MaxStreams < 5)
		throw new RuntimeException("");
	    D3DPRESENT_PARAMETERS d3dpresent_parameters
		= new D3DPRESENT_PARAMETERS(canvas);
	    d3dpresent_parameters.Windowed = true;
	    d3dpresent_parameters.EnableAutoDepthStencil = true;
	    d3dpresent_parameters.BackBufferWidth = canvas.getWidth();
	    d3dpresent_parameters.BackBufferHeight = canvas.getHeight();
	    d3dpresent_parameters.BackBufferCount = 1;
	    d3dpresent_parameters.PresentationInterval = -2147483648;
	    if (!method17401(i, i_158_, l, integer.intValue(),
			     d3dpresent_parameters))
		throw new RuntimeException("");
	    int i_159_ = 0;
	    if ((d3dcaps.DevCaps & 0x100000) != 0)
		i_159_ |= 0x10;
	    long l_160_ = 0L;
	    try {
		l_160_ = IDirect3D.CreateDeviceContext(l, i, i_158_, canvas,
						       i_159_ | 0x40,
						       d3dpresent_parameters);
	    } catch (RuntimeException_Sub1 runtimeexception_sub1) {
		l_160_
		    = IDirect3D.CreateDeviceContext(l, i, i_158_, canvas,
						    i_159_ & ~0x100000 | 0x20,
						    d3dpresent_parameters);
	    }
	    class87_sub2_sub1
		= new Class87_Sub2_Sub1(i, i_158_, l, l_160_,
					d3dpresent_parameters, d3dcaps,
					class106, interface7, class272,
					integer.intValue());
	    if (!class87_sub2_sub1.aHashtable995.containsKey(canvas)) {
		Class421_Sub23.method14319(canvas, (short) 721);
		class87_sub2_sub1.method2457
		    (canvas,
		     new Class169_Sub1_Sub2_Sub2(class87_sub2_sub1, canvas,
						 canvas.getWidth(),
						 canvas.getHeight(), true),
		     -1875927384);
	    }
	    class87_sub2_sub1.method2098(canvas, (byte) -107);
	    class87_sub2_sub1.method15309();
	    class87_sub2_sub1_157_ = class87_sub2_sub1;
	} catch (RuntimeException runtimeexception) {
	    if (class87_sub2_sub1 != null)
		class87_sub2_sub1.method2080();
	    throw runtimeexception;
	}
	return class87_sub2_sub1_157_;
    }
    
    public void method15495(Class276 class276, Class276 class276_161_,
			    Class276 class276_162_) {
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888,
				     256, class276.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 2,
				     class276_161_.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 3,
				     class276_162_.aFloatArray4141);
    }
    
    boolean method17416() {
	int i = IDirect3DDevice.TestCooperativeLevel(((Class87_Sub2_Sub1) this)
						     .aLong10888);
	if (i == 0 || i == -2005530519) {
	    IDirect3DDevice.SetDepthStencilSurface((((Class87_Sub2_Sub1) this)
						    .aLong10888),
						   0L);
	    for (int i_163_ = 0; i_163_ < 4; i_163_++)
		IDirect3DDevice.SetRenderTarget((((Class87_Sub2_Sub1) this)
						 .aLong10888),
						i_163_, 0L);
	    for (int i_164_ = 0; i_164_ < 4; i_164_++)
		IDirect3DDevice.SetStreamSource((((Class87_Sub2_Sub1) this)
						 .aLong10888),
						i_164_, 0L, 0, 0);
	    for (int i_165_ = 0; i_165_ < 4; i_165_++)
		IDirect3DDevice.SetTexture((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   i_165_, 0L);
	    IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				       0L);
	    method15330();
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		.BackBufferWidth
		= 0;
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		.BackBufferHeight
		= 0;
	    if (method17401(((Class87_Sub2_Sub1) this).anInt10911,
			    ((Class87_Sub2_Sub1) this).anInt10892,
			    ((Class87_Sub2_Sub1) this).aLong10887, anInt9270,
			    (((Class87_Sub2_Sub1) this)
			     .aD3DPRESENT_PARAMETERS10889))) {
		int i_166_
		    = IDirect3DDevice.Reset((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    (((Class87_Sub2_Sub1) this)
					     .aD3DPRESENT_PARAMETERS10889));
		if (Class31.method992(i_166_)) {
		    method15313();
		    method15598();
		    return true;
		}
		System.exit(0);
	    }
	}
	return false;
    }
    
    boolean method17417() {
	int i = IDirect3DDevice.TestCooperativeLevel(((Class87_Sub2_Sub1) this)
						     .aLong10888);
	if (i == 0 || i == -2005530519) {
	    IDirect3DDevice.SetDepthStencilSurface((((Class87_Sub2_Sub1) this)
						    .aLong10888),
						   0L);
	    for (int i_167_ = 0; i_167_ < 4; i_167_++)
		IDirect3DDevice.SetRenderTarget((((Class87_Sub2_Sub1) this)
						 .aLong10888),
						i_167_, 0L);
	    for (int i_168_ = 0; i_168_ < 4; i_168_++)
		IDirect3DDevice.SetStreamSource((((Class87_Sub2_Sub1) this)
						 .aLong10888),
						i_168_, 0L, 0, 0);
	    for (int i_169_ = 0; i_169_ < 4; i_169_++)
		IDirect3DDevice.SetTexture((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   i_169_, 0L);
	    IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				       0L);
	    method15330();
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		.BackBufferWidth
		= 0;
	    ((Class87_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS10889
		.BackBufferHeight
		= 0;
	    if (method17401(((Class87_Sub2_Sub1) this).anInt10911,
			    ((Class87_Sub2_Sub1) this).anInt10892,
			    ((Class87_Sub2_Sub1) this).aLong10887, anInt9270,
			    (((Class87_Sub2_Sub1) this)
			     .aD3DPRESENT_PARAMETERS10889))) {
		int i_170_
		    = IDirect3DDevice.Reset((((Class87_Sub2_Sub1) this)
					     .aLong10888),
					    (((Class87_Sub2_Sub1) this)
					     .aD3DPRESENT_PARAMETERS10889));
		if (Class31.method992(i_170_)) {
		    method15313();
		    method15598();
		    return true;
		}
		System.exit(0);
	    }
	}
	return false;
    }
    
    void method17418(Interface25 interface25) {
	if (method17389(interface25) == null)
	    ((Class87_Sub2_Sub1) this).aClass420_10903
		.method7495(new Class243_Sub35(interface25), 1663553157);
    }
    
    void method17419(Interface25 interface25) {
	Class243_Sub35 class243_sub35 = method17389(interface25);
	if (class243_sub35 != null)
	    class243_sub35.method4894(244185852);
    }
    
    public void method2479(int i, int i_171_) {
	IDirect3DDevice.Clear(((Class87_Sub2_Sub1) this).aLong10888, i, i_171_,
			      1.0F, 0);
    }
    
    public void method15332(Class276 class276, Class276 class276_172_,
			    Class276 class276_173_) {
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888,
				     256, class276.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 2,
				     class276_172_.aFloatArray4141);
	IDirect3DDevice.SetTransform(((Class87_Sub2_Sub1) this).aLong10888, 3,
				     class276_173_.aFloatArray4141);
    }
    
    final void method15349() {
	if (aBool9153)
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   60, anInt9231);
    }
    
    void method15433() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 15,
				    aBool9269);
    }
    
    final void method15383(int i, Class385 class385, boolean bool,
			   boolean bool_174_) {
	if (aBool9153) {
	    int i_175_ = 0;
	    int i_176_;
	    switch (i) {
	    case 2:
		i_176_ = 26;
		break;
	    default:
		i_176_ = 2;
		break;
	    case 1:
		i_176_ = 3;
	    }
	    if (bool)
		i_175_ |= 0x20;
	    if (bool_174_)
		i_175_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, i_176_,
						 (method17399(class385)
						  | i_175_));
	}
    }
    
    Interface45 method15429(Class173 class173, Class90 class90, int i,
			    int i_177_) {
	return new Class258_Sub1_Sub1(this, class173, class90, i, i_177_);
    }
    
    final void method17420(long l) {
	((Class87_Sub2_Sub1) this).aLong10904 = l;
	IDirect3DDevice.SetVertexShader(((Class87_Sub2_Sub1) this).aLong10888,
					l);
    }
    
    final void method17421(long l) {
	IDirect3DDevice.SetPixelShader(((Class87_Sub2_Sub1) this).aLong10888,
				       l);
    }
    
    boolean method15497(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 3,
				      method17409(class173, class90))));
    }
    
    boolean method15691(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 3,
				      method17409(class173, class90))));
    }
    
    boolean method15458(Class173 class173, Class90 class90) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class31.method992(IDirect3D.GetAdapterDisplayMode
				  (((Class87_Sub2_Sub1) this).aLong10887,
				   ((Class87_Sub2_Sub1) this).anInt10911,
				   d3ddisplaymode))
		&& Class31.method992(IDirect3D.CheckDeviceFormat
				     (((Class87_Sub2_Sub1) this).aLong10887,
				      ((Class87_Sub2_Sub1) this).anInt10911,
				      ((Class87_Sub2_Sub1) this).anInt10892,
				      d3ddisplaymode.Format, 0, 3,
				      method17409(class173, class90))));
    }
    
    void method15584() {
	if (aBool9153) {
	    D3DLIGHT.SetAmbient(((Class87_Sub2_Sub1) this).aLong10885,
				aFloat9154 * aFloat9145,
				aFloat9213 * aFloat9145,
				aFloat9214 * aFloat9145, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    Interface38 method15459(Class173 class173, int i, int i_178_, int i_179_,
			    boolean bool, byte[] is) {
	return new Class258_Sub3(this, class173, i, i_178_, i_179_, bool, is);
    }
    
    final void method17422(Class258_Sub1 class258_sub1) {
	method17406(class258_sub1);
	if (((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]
	    != ((Class258_Sub1) class258_sub1).aBool10131) {
	    IDirect3DDevice.SetSamplerState
		(((Class87_Sub2_Sub1) this).aLong10888, anInt9225, 1,
		 ((Class258_Sub1) class258_sub1).aBool10131 ? 1 : 3);
	    ((Class87_Sub2_Sub1) this).aBoolArray10907[anInt9225]
		= ((Class258_Sub1) class258_sub1).aBool10131;
	}
	if (((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]
	    != ((Class258_Sub1) class258_sub1).aBool10126) {
	    IDirect3DDevice.SetSamplerState
		(((Class87_Sub2_Sub1) this).aLong10888, anInt9225, 2,
		 ((Class258_Sub1) class258_sub1).aBool10126 ? 1 : 3);
	    ((Class87_Sub2_Sub1) this).aBoolArray10897[anInt9225]
		= ((Class258_Sub1) class258_sub1).aBool10126;
	}
    }
    
    void method15557() {
	int i;
	for (i = 0; i < anInt9220; i++) {
	    Class243_Sub42 class243_sub42 = aClass243_Sub42Array9218[i];
	    int i_180_ = i + 2;
	    int i_181_ = class243_sub42.method16341(-727934103);
	    float f = class243_sub42.method16337(554323130) / 255.0F;
	    D3DLIGHT.SetPosition(((Class87_Sub2_Sub1) this).aLong10894,
				 (float) class243_sub42
					     .method16334(1141430223),
				 (float) class243_sub42.method16335(490100194),
				 (float) class243_sub42
					     .method16336(-1158629699));
	    D3DLIGHT.SetDiffuse(((Class87_Sub2_Sub1) this).aLong10894,
				(float) (i_181_ >> 16 & 0xff) * f,
				(float) (i_181_ >> 8 & 0xff) * f,
				(float) (i_181_ & 0xff) * f, 0.0F);
	    D3DLIGHT.SetAttenuation
		(((Class87_Sub2_Sub1) this).aLong10894, 0.0F, 0.0F,
		 1.0F / (float) (class243_sub42.method16345(-117934955)
				 * class243_sub42.method16345(-117934955)));
	    D3DLIGHT.SetRange(((Class87_Sub2_Sub1) this).aLong10894,
			      (float) class243_sub42.method16345(-117934955));
	    IDirect3DDevice.SetLight(((Class87_Sub2_Sub1) this).aLong10888,
				     i_180_,
				     ((Class87_Sub2_Sub1) this).aLong10894);
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					i_180_, true);
	}
	for (/**/; i < anInt9219; i++)
	    IDirect3DDevice.LightEnable(((Class87_Sub2_Sub1) this).aLong10888,
					i + 2, false);
    }
    
    static final int method17423(Class90 class90) {
	if (class90 == Class90.aClass90_1042)
	    return 80;
	if (class90 == Class90.aClass90_1043)
	    return 77;
	throw new IllegalArgumentException("");
    }
    
    static final int method17424(Class391 class391) {
	switch (class391.anInt5690) {
	case 0:
	    return 2;
	case 1:
	    return 10;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 26;
	case 2:
	    return 7;
	case 4:
	    return 4;
	}
    }
    
    static final int method17425(Class391 class391) {
	switch (class391.anInt5690) {
	case 0:
	    return 2;
	case 1:
	    return 10;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 26;
	case 2:
	    return 7;
	case 4:
	    return 4;
	}
    }
    
    static final int method17426(Class391 class391) {
	switch (class391.anInt5690) {
	case 0:
	    return 2;
	case 1:
	    return 10;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 26;
	case 2:
	    return 7;
	case 4:
	    return 4;
	}
    }
    
    static final int method17427(Class391 class391) {
	switch (class391.anInt5690) {
	case 0:
	    return 2;
	case 1:
	    return 10;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 26;
	case 2:
	    return 7;
	case 4:
	    return 4;
	}
    }
    
    void method15364() {
	if (aBool9153) {
	    D3DLIGHT.SetAmbient(((Class87_Sub2_Sub1) this).aLong10885,
				aFloat9154 * aFloat9145,
				aFloat9213 * aFloat9145,
				aFloat9214 * aFloat9145, 0.0F);
	    ((Class87_Sub2_Sub1) this).aBool10890 = false;
	}
    }
    
    static final int method17428(Class366 class366) {
	switch (class366.anInt5526) {
	case 4:
	    return 256;
	case 2:
	    return 4;
	case 1:
	    return 3;
	case 3:
	    return 1;
	case 5:
	    return 2;
	default:
	    return 0;
	}
    }
    
    static final int method17429(Class366 class366) {
	switch (class366.anInt5526) {
	case 4:
	    return 256;
	case 2:
	    return 4;
	case 1:
	    return 3;
	case 3:
	    return 1;
	case 5:
	    return 2;
	default:
	    return 0;
	}
    }
    
    void method15643() {
	if (((Class87_Sub2_Sub1) this).aLong10904 == 0L
	    && aClass366Array9228[anInt9225] != Class366.aClass366_5527) {
	    if (aClass366Array9228[anInt9225] == Class366.aClass366_5528)
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5454
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    else
		IDirect3DDevice.SetTransform
		    (((Class87_Sub2_Sub1) this).aLong10888, 16 + anInt9225,
		     (aClass276Array9265[anInt9225].method5481
		      (((Class87_Sub2_Sub1) this).aFloatArray10896)));
	    int i = method17413(aClass366Array9228[anInt9225]);
	    if (i != ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225]) {
		IDirect3DDevice.SetTextureStageState(((Class87_Sub2_Sub1)
						      this).aLong10888,
						     anInt9225, 24, i);
		((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = i;
	    }
	} else {
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, 24, 0);
	    ((Class87_Sub2_Sub1) this).anIntArray10901[anInt9225] = 0;
	}
    }
    
    void method15695(boolean bool) {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 161,
				    bool);
    }
    
    void method15689() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 174,
				    aBool9175);
    }
    
    public Class169_Sub2 method2395() {
	return new Class169_Sub2_Sub3_Sub2(this);
    }
    
    void method15698(Interface31 interface31) {
	IDirect3DDevice.SetIndices(((Class87_Sub2_Sub1) this).aLong10888,
				   (((Class262) (Class262) interface31)
				    .aLong4046));
    }
    
    void method15547(int i) {
	if (!((Class87_Sub2_Sub1) this).aBool10909) {
	    int i_182_ = (i & 0x2) != 0 ? 2 : 3;
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   8, i_182_);
	}
    }
    
    byte[] method17430(String string) {
	return method15304("dx", string);
    }
    
    public Interface4 method2105(int i, int i_183_) {
	return new Class345(this, Class90.aClass90_1043, i, i_183_, 0);
    }
    
    byte[] method17431(String string) {
	return method15304("dx", string);
    }
    
    static final int method17432(Class173 class173, Class90 class90) {
	switch (class90.anInt1046 * -295509) {
	default:
	    break;
	case 0:
	    switch (class173.anInt2137 * -598663847) {
	    case 1:
		return 22;
	    case 4:
		return 21;
	    case 5:
		return Class28.anInt299 * 1217850121;
	    default:
		break;
	    case 2:
		return Class28.anInt298 * 1893612539;
	    case 9:
		return 28;
	    case 7:
		return 77;
	    case 6:
		return 51;
	    case 0:
		return 50;
	    }
	    break;
	case 1:
	    if (class173 == Class173.aClass173_2131)
		return 113;
	    break;
	case 4:
	    if (class173 == Class173.aClass173_2131)
		return 116;
	}
	throw new IllegalArgumentException("");
    }
    
    final void method15626(int i, Class385 class385, boolean bool) {
	if (aBool9153) {
	    int i_184_ = 0;
	    int i_185_;
	    switch (i) {
	    default:
		i_185_ = 5;
		break;
	    case 2:
		i_185_ = 27;
		break;
	    case 1:
		i_185_ = 6;
	    }
	    if (bool)
		i_184_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class87_Sub2_Sub1) this)
						  .aLong10888),
						 anInt9225, i_185_,
						 (method17399(class385)
						  | i_184_));
	}
    }
    
    void method15425() {
	if (aClass169_993 != null)
	    IDirect3DDevice.SetViewport(((Class87_Sub2_Sub1) this).aLong10888,
					anInt9149 + anInt9195,
					anInt9272 + anInt9168, anInt9197,
					anInt9198, aFloat9244, aFloat9182);
    }
    
    static final int method17433(Class90 class90) {
	if (class90 == Class90.aClass90_1042)
	    return 80;
	if (class90 == Class90.aClass90_1043)
	    return 77;
	throw new IllegalArgumentException("");
    }
    
    void method15568() {
	IDirect3DDevice.method16774(((Class87_Sub2_Sub1) this).aLong10888, 7,
				    aBool9203);
    }
    
    static final int method17434(Class311 class311) {
	switch (class311.anInt4594) {
	case 1:
	    return 6;
	case 4:
	    return 4;
	case 3:
	    return 1;
	case 5:
	    return 3;
	case 2:
	    return 2;
	case 0:
	    return 5;
	default:
	    throw new IllegalArgumentException("");
	}
    }
    
    static boolean method17435(int i, int i_186_, long l, int i_187_,
			       D3DPRESENT_PARAMETERS d3dpresent_parameters) {
	int i_188_ = 0;
	int i_189_ = 0;
	int i_190_ = 0;
	boolean bool;
	try {
	    D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	    if (Class31.method991
		(IDirect3D.GetAdapterDisplayMode(l, i, d3ddisplaymode)))
		return false;
	while_103_:
	    for (/**/; i_187_ >= 0; i_187_--) {
		if (i_187_ != 1) {
		    i_190_ = 0 + i_187_;
		    for (int i_191_ = 0; i_191_ < anIntArray10886.length;
			 i_191_++) {
			if (IDirect3D.CheckDeviceType(l, i, i_186_,
						      d3ddisplaymode.Format,
						      anIntArray10886[i_191_],
						      true) == 0
			    && IDirect3D.CheckDeviceFormat(l, i, i_186_,
							   (d3ddisplaymode
							    .Format),
							   1, 1,
							   (anIntArray10886
							    [i_191_])) == 0
			    && (i_187_ == 0
				|| (IDirect3D.CheckDeviceMultiSampleType
				    (l, i, i_186_, anIntArray10886[i_191_],
				     true, i_190_)) == 0)) {
			    for (int i_192_ = 0;
				 i_192_ < anIntArray10914.length; i_192_++) {
				if ((IDirect3D.CheckDeviceFormat
				     (l, i, i_186_, d3ddisplaymode.Format, 2,
				      1, anIntArray10914[i_192_])) == 0
				    && (IDirect3D.CheckDepthStencilMatch
					(l, i, i_186_, d3ddisplaymode.Format,
					 anIntArray10886[i_191_],
					 anIntArray10914[i_192_])) == 0
				    && (i_187_ == 0
					|| (IDirect3D
						.CheckDeviceMultiSampleType
					    (l, i, i_186_,
					     anIntArray10914[i_191_], true,
					     i_190_)) == 0)) {
				    i_189_ = anIntArray10886[i_191_];
				    i_188_ = anIntArray10914[i_192_];
				    break while_103_;
				}
			    }
			}
		    }
		}
	    }
	    if (i_187_ < 0 || i_189_ == 0 || i_188_ == 0)
		return false;
	    d3dpresent_parameters.BackBufferFormat = i_189_;
	    d3dpresent_parameters.AutoDepthStencilFormat = i_188_;
	    d3dpresent_parameters.MultiSampleType = i_190_;
	    d3dpresent_parameters.MultiSampleQuality = 0;
	    bool = true;
	} catch (Throwable throwable) {
	    return false;
	}
	return bool;
    }
    
    synchronized void method17436(long l) {
	if (((Class87_Sub2_Sub1) this).anInt10912
	    == ((Class87_Sub2_Sub1) this).anInt10910) {
	    ((Class87_Sub2_Sub1) this).anInt10910 *= 2;
	    long[] ls = new long[((Class87_Sub2_Sub1) this).anInt10910];
	    System.arraycopy(((Class87_Sub2_Sub1) this).aLongArray10913, 0, ls,
			     0, ((Class87_Sub2_Sub1) this).anInt10912);
	    ((Class87_Sub2_Sub1) this).aLongArray10913 = ls;
	}
	((Class87_Sub2_Sub1) this).aLongArray10913[(((Class87_Sub2_Sub1) this)
						    .anInt10912)]
	    = l;
	((Class87_Sub2_Sub1) this).anInt10912++;
    }
    
    synchronized void method17437(long l) {
	if (((Class87_Sub2_Sub1) this).anInt10912
	    == ((Class87_Sub2_Sub1) this).anInt10910) {
	    ((Class87_Sub2_Sub1) this).anInt10910 *= 2;
	    long[] ls = new long[((Class87_Sub2_Sub1) this).anInt10910];
	    System.arraycopy(((Class87_Sub2_Sub1) this).aLongArray10913, 0, ls,
			     0, ((Class87_Sub2_Sub1) this).anInt10912);
	    ((Class87_Sub2_Sub1) this).aLongArray10913 = ls;
	}
	((Class87_Sub2_Sub1) this).aLongArray10913[(((Class87_Sub2_Sub1) this)
						    .anInt10912)]
	    = l;
	((Class87_Sub2_Sub1) this).anInt10912++;
    }
    
    synchronized void method17438(long l) {
	if (((Class87_Sub2_Sub1) this).anInt10912
	    == ((Class87_Sub2_Sub1) this).anInt10910) {
	    ((Class87_Sub2_Sub1) this).anInt10910 *= 2;
	    long[] ls = new long[((Class87_Sub2_Sub1) this).anInt10910];
	    System.arraycopy(((Class87_Sub2_Sub1) this).aLongArray10913, 0, ls,
			     0, ((Class87_Sub2_Sub1) this).anInt10912);
	    ((Class87_Sub2_Sub1) this).aLongArray10913 = ls;
	}
	((Class87_Sub2_Sub1) this).aLongArray10913[(((Class87_Sub2_Sub1) this)
						    .anInt10912)]
	    = l;
	((Class87_Sub2_Sub1) this).anInt10912++;
    }
    
    void method15701(int i) {
	if (!((Class87_Sub2_Sub1) this).aBool10909) {
	    int i_193_ = (i & 0x2) != 0 ? 2 : 3;
	    IDirect3DDevice.SetRenderState((((Class87_Sub2_Sub1) this)
					    .aLong10888),
					   8, i_193_);
	}
    }
    
    void method15339() {
	IDirect3DDevice.SetScissorRect(((Class87_Sub2_Sub1) this).aLong10888,
				       anInt9149 + anInt9176,
				       anInt9272 + anInt9253, anInt9190,
				       anInt9202);
    }
}
