/* Class151_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 Class151_Sub2_Sub1 extends Class151_Sub2
{
    int anInt11094;
    int anInt11095;
    boolean aBool11096;
    long aLong11097;
    boolean aBool11098;
    Class230_Sub2 aClass230_Sub2_11099;
    Class656 aClass656_11100;
    boolean aBool11101;
    long aLong11102;
    long aLong11103;
    D3DDISPLAYMODE aD3DDISPLAYMODE11104;
    boolean aBool11105;
    boolean[] aBoolArray11106;
    float[] aFloatArray11107;
    boolean[] aBoolArray11108;
    boolean[] aBoolArray11109;
    Class313[] aClass313Array11110;
    int[] anIntArray11111;
    long aLong11112;
    static int[] anIntArray11113;
    long aLong11114;
    D3DCAPS aD3DCAPS11115;
    boolean aBool11116;
    boolean aBool11117;
    boolean aBool11118;
    long[] aLongArray11119;
    int anInt11120;
    boolean aBool11121;
    D3DPRESENT_PARAMETERS aD3DPRESENT_PARAMETERS11122;
    boolean aBool11123;
    boolean aBool11124;
    boolean aBool11125;
    long aLong11126 = 0L;
    Class403 aClass403_11127;
    boolean aBool11128;
    long[] aLongArray11129;
    static final int anInt11130 = 3;
    long aLong11131;
    int[] anIntArray11132;
    long[] aLongArray11133;
    boolean[] aBoolArray11134;
    int anInt11135;
    int anInt11136;
    static int[] anIntArray11137 = { 77, 80 };
    int anInt11138;
    
    public void method2204(int i, int i_0_) {
	IDirect3DDevice.Clear(((Class151_Sub2_Sub1) this).aLong11097, i, i_0_,
			      1.0F, 0);
    }
    
    public boolean method8240(boolean bool) {
	if (bool)
	    return ((Class151_Sub2_Sub1) this).aBool11123;
	return (((Class151_Sub2_Sub1) this).aBool11123
		&& ((Class151_Sub2_Sub1) this).aBool11124);
    }
    
    static Class151 method10179
	(Canvas canvas, Class140 class140, Interface19 interface19,
	 Interface41 interface41, Interface44 interface44,
	 Interface43 interface43, Class411 class411, Integer integer) {
	Class151_Sub2_Sub1 class151_sub2_sub1 = null;
	Class151_Sub2_Sub1 class151_sub2_sub1_1_;
	try {
	    int i = 0;
	    int i_2_ = 1;
	    long l = IDirect3D.Direct3DCreate();
	    D3DCAPS d3dcaps = new D3DCAPS();
	    IDirect3D.GetDeviceCaps(l, i, i_2_, d3dcaps);
	    if ((d3dcaps.RasterCaps & 0x1000000) == 0)
		throw new RuntimeException("");
	    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;
	    D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	    if (!method10196(i, i_2_, l, integer.intValue(), d3ddisplaymode,
			     d3dpresent_parameters))
		throw new RuntimeException("");
	    int i_3_ = 0;
	    if ((d3dcaps.DevCaps & 0x100000) != 0)
		i_3_ |= 0x10;
	    long l_4_ = 0L;
	    try {
		l_4_ = IDirect3D.CreateDeviceContext(l, i, i_2_, canvas,
						     i_3_ | 0x40,
						     d3dpresent_parameters);
	    } catch (RuntimeException_Sub5 runtimeexception_sub5) {
		l_4_ = IDirect3D.CreateDeviceContext(l, i, i_2_, canvas,
						     i_3_ & ~0x100000 | 0x20,
						     d3dpresent_parameters);
	    }
	    class151_sub2_sub1
		= new Class151_Sub2_Sub1(i, i_2_, l, l_4_, d3ddisplaymode,
					 d3dpresent_parameters, d3dcaps,
					 class140, interface19, interface41,
					 interface44, interface43, class411,
					 integer.intValue());
	    if (!class151_sub2_sub1.aHashtable1832.containsKey(canvas)) {
		Class487_Sub22.method9351(canvas, (byte) 19);
		class151_sub2_sub1.method1991
		    (canvas,
		     new Class144_Sub1_Sub1_Sub1(class151_sub2_sub1, canvas,
						 canvas.getWidth(),
						 canvas.getHeight(), true),
		     -829972221);
	    }
	    class151_sub2_sub1.method2012(canvas, 1526072774);
	    class151_sub2_sub1.method8421();
	    class151_sub2_sub1_1_ = class151_sub2_sub1;
	} catch (RuntimeException runtimeexception) {
	    if (class151_sub2_sub1 != null)
		class151_sub2_sub1.method2233();
	    throw runtimeexception;
	}
	return class151_sub2_sub1_1_;
    }
    
    void method8346() {
	for (int i = 0; i < anInt9063; i++) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 2, 1);
	    ((Class151_Sub2_Sub1) this).aClass313Array11110[i]
		= Class313.aClass313_3468;
	    boolean[] bools = ((Class151_Sub2_Sub1) this).aBoolArray11106;
	    int i_5_ = i;
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[i] = true;
	    bools[i_5_] = true;
	    ((Class151_Sub2_Sub1) this).aBoolArray11109[i] = false;
	    ((Class151_Sub2_Sub1) this).anIntArray11111[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, 0);
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 206,
				   aBool9072);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       181, 0);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       145, 1);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 38,
				   0.95F);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       35, 3);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 154,
				   1.0F);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11102, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11103, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11131, 1);
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	super.method8251();
    }
    
    void method8388() {
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) -2547);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) -19)) {
	    Interface49 interface49
		= (Interface49) class487_sub24.anObject10235;
	    interface49.method315();
	    if (interface49 == aClass144_1857)
		interface49.method320();
	}
	super.method8388();
    }
    
    void method8466() {
	if (((Class151_Sub2_Sub1) this).aLong11114 == 0L
	    && aClass340Array9031[anInt9010] != Class340.aClass340_3636) {
	    if (aClass340Array9031[anInt9010] == Class340.aClass340_3638)
		IDirect3DDevice.SetTransform
		    (((Class151_Sub2_Sub1) this).aLong11097, 16 + anInt9010,
		     (aClass403Array9033[anInt9010].method4913
		      (((Class151_Sub2_Sub1) this).aFloatArray11107)));
	    else
		IDirect3DDevice.SetTransform
		    (((Class151_Sub2_Sub1) this).aLong11097, 16 + anInt9010,
		     (aClass403Array9033[anInt9010].method4888
		      (((Class151_Sub2_Sub1) this).aFloatArray11107)));
	    int i = method10198(aClass340Array9031[anInt9010]);
	    if (i != ((Class151_Sub2_Sub1) this).anIntArray11111[anInt9010]) {
		IDirect3DDevice.SetTextureStageState(((Class151_Sub2_Sub1)
						      this).aLong11097,
						     anInt9010, 24, i);
		((Class151_Sub2_Sub1) this).anIntArray11111[anInt9010] = i;
	    }
	} else {
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 24, 0);
	    ((Class151_Sub2_Sub1) this).anIntArray11111[anInt9010] = 0;
	}
    }
    
    boolean method10180(int i, int i_6_) {
	int i_7_
	    = IDirect3DDevice.TestCooperativeLevel(((Class151_Sub2_Sub1) this)
						   .aLong11097);
	if (i_7_ == 0 || i_7_ == -2005530519) {
	    IDirect3DDevice.SetDepthStencilSurface((((Class151_Sub2_Sub1) this)
						    .aLong11097),
						   0L);
	    for (int i_8_ = 1; i_8_ < 4; i_8_++)
		IDirect3DDevice.SetRenderTarget((((Class151_Sub2_Sub1) this)
						 .aLong11097),
						i_8_, 0L);
	    for (int i_9_ = 0; i_9_ < 4; i_9_++)
		IDirect3DDevice.SetStreamSource((((Class151_Sub2_Sub1) this)
						 .aLong11097),
						i_9_, 0L, 0, 0);
	    for (int i_10_ = 0; i_10_ < 4; i_10_++)
		IDirect3DDevice.SetTexture((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   i_10_, 0L);
	    IDirect3DDevice.SetIndices(((Class151_Sub2_Sub1) this).aLong11097,
				       0L);
	    method8253();
	    ((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		.BackBufferWidth
		= i;
	    ((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		.BackBufferHeight
		= i_6_;
	    ((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		.BackBufferCount
		= 1;
	    if (method10196(((Class151_Sub2_Sub1) this).anInt11138,
			    ((Class151_Sub2_Sub1) this).anInt11095,
			    ((Class151_Sub2_Sub1) this).aLong11126, anInt9057,
			    ((Class151_Sub2_Sub1) this).aD3DDISPLAYMODE11104,
			    (((Class151_Sub2_Sub1) this)
			     .aD3DPRESENT_PARAMETERS11122))) {
		int i_11_
		    = IDirect3DDevice.Reset((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    (((Class151_Sub2_Sub1) this)
					     .aD3DPRESENT_PARAMETERS11122));
		if (Class326.method4295(i_11_)) {
		    ((Class151_Sub2_Sub1) this).aBool11101 = false;
		    method8388();
		    method8251();
		    return true;
		}
	    }
	}
	return false;
    }
    
    public Class127 method2285() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class151_Sub2_Sub1) this).aLong11126,
				       ((Class151_Sub2_Sub1) this).anInt11138,
				       0, d3dadapter_identifier);
	return new Class127(d3dadapter_identifier.VendorID,
			    method8241() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion, method8241());
    }
    
    void method1989(int i, int i_12_) throws Exception_Sub7 {
	if (((Class151_Sub2_Sub1) this).aBool11101) {
	    if (!method10180(aClass144_Sub1_1853.method1943(),
			     aClass144_Sub1_1853.method1944()))
		return;
	    ((Class144_Sub1_Sub1_Sub1) aClass144_Sub1_1853).method315();
	} else
	    IDirect3DDevice.EndScene(((Class151_Sub2_Sub1) this).aLong11097);
	int i_13_ = aClass144_Sub1_1853.method8234();
	if (Class326.method4294(i_13_)) {
	    ((Class151_Sub2_Sub1) this).aBool11101 = true;
	    aClass144_Sub1_1853.method80();
	} else {
	    IDirect3DDevice.BeginScene(((Class151_Sub2_Sub1) this).aLong11097);
	    if (anInterface19_1837 != null)
		anInterface19_1837.method86(682260641);
	}
    }
    
    public void method2391() {
	long l = IDirect3DDevice
		     .CreateEventQuery(((Class151_Sub2_Sub1) this).aLong11097);
	if (Class326.method4295(IDirect3DEventQuery.Issue(l))) {
	    for (;;) {
		int i = IDirect3DEventQuery.IsSignaled(l);
		if (i != 1)
		    break;
		Thread.yield();
	    }
	}
	IUnknown.Release(l);
    }
    
    void method2233() {
	super.method2233();
	if (((Class151_Sub2_Sub1) this).aLong11102 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11102);
	    ((Class151_Sub2_Sub1) this).aLong11102 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11103 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11103);
	    ((Class151_Sub2_Sub1) this).aLong11103 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11131 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11131);
	    ((Class151_Sub2_Sub1) this).aLong11131 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11097 != 0L) {
	    IDirect3DDevice.Destroy(((Class151_Sub2_Sub1) this).aLong11097);
	    ((Class151_Sub2_Sub1) this).aLong11097 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11126 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11126);
	    ((Class151_Sub2_Sub1) this).aLong11126 = 0L;
	}
    }
    
    public long method2374(int i, int i_14_) {
	return method10182(i, i_14_, null, null);
    }
    
    public float method8365() {
	return -0.5F;
    }
    
    boolean method8358(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 4,
					method10193(class116, class155))));
    }
    
    Class144_Sub1 method2053(Canvas canvas, int i, int i_15_) {
	return new Class144_Sub1_Sub1_Sub1(this, canvas, i, i_15_, false);
    }
    
    public Interface18 method2101(int i, int i_16_, Class116 class116,
				  Class155 class155, int i_17_) {
	return new Class390(this, class116, class155, i, i_16_, i_17_);
    }
    
    void method8470() {
	if (aBool8921) {
	    int i = (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]
		     ? method10186(aClass345Array8917[anInt9010]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 4, i);
	}
    }
    
    public Class136 method2282(Class136 class136, Class136 class136_18_,
			       float f, Class136 class136_19_) {
	return f < 0.5F ? class136 : class136_18_;
    }
    
    void method8438() {
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) -10203);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) 0)) {
	    Interface49 interface49
		= (Interface49) class487_sub24.anObject10235;
	    interface49.method315();
	    if (interface49 == aClass144_1857)
		interface49.method320();
	}
	super.method8388();
    }
    
    public void finalize() {
	super.finalize();
    }
    
    public boolean method2366() {
	return true;
    }
    
    public int[] method2021(int i, int i_20_, int i_21_, int i_22_) {
	method2070();
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	long l_23_
	    = IDirect3DDevice.CreateRenderTarget((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 i_21_, i_22_, 21, 0, 0, true);
	int i_24_ = IDirect3DDevice.StretchRect((((Class151_Sub2_Sub1) this)
						 .aLong11097),
						l, i, i_20_, i_21_, i_22_,
						l_23_, 0, 0, i_21_, i_22_, 1);
	method8242(i_21_ * i_22_ * 4);
	if (Class326.method4295(i_24_)) {
	    is = new int[i_21_ * i_22_];
	    IDirect3DSurface.Download(l_23_, 0, 0, i_21_, i_22_, i_21_ * 4, 16,
				      aLong8955);
	    aByteBuffer9026.clear();
	    aByteBuffer9026.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_23_);
	return is;
    }
    
    public void method2220() {
	/* empty */
    }
    
    public boolean method2376() {
	return true;
    }
    
    void method10181(int i, int i_25_) {
	method2383();
	method2031(i, i_25_, 370517870);
	((Class151_Sub2_Sub1) this).aLong11112
	    = (IDirect3DDevice.CreateRenderTarget
	       (((Class151_Sub2_Sub1) this).aLong11097, i, i_25_,
		method10193(Class116.aClass116_1448, Class155.aClass155_1894),
		0, 0, false));
	for (int i_26_ = 0; i_26_ < 3; i_26_++)
	    ((Class151_Sub2_Sub1) this).aLongArray11133[i_26_]
		= (IDirect3DDevice.CreateOffscreenPlainSurface
		   (((Class151_Sub2_Sub1) this).aLong11097, i, i_25_,
		    method10193(Class116.aClass116_1448,
				Class155.aClass155_1894),
		    2));
	method8242(i * i_25_ * 4);
    }
    
    public boolean method2236() {
	if (((Class151_Sub2_Sub1) this).aBool11101)
	    return false;
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11136])
	    != 0L)
	    return false;
	return true;
    }
    
    public boolean method2024() {
	return true;
    }
    
    public boolean method2025() {
	return false;
    }
    
    void method8264() {
	if (aBool8921 && !((Class151_Sub2_Sub1) this).aBool11105) {
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					0, false);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					1, false);
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097, 0,
				     ((Class151_Sub2_Sub1) this).aLong11102);
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097, 1,
				     ((Class151_Sub2_Sub1) this).aLong11103);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					0, true);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					1, true);
	    ((Class151_Sub2_Sub1) this).aBool11105 = true;
	}
    }
    
    public int method2026() {
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11135])
	    == 0L)
	    return -1;
	return (Class326.method4295(IDirect3DEventQuery.IsSignaled
				    (((Class151_Sub2_Sub1) this)
				     .aLongArray11119
				     [((Class151_Sub2_Sub1) this).anInt11135]))
		? (((Class151_Sub2_Sub1) this).anIntArray11132
		   [((Class151_Sub2_Sub1) this).anInt11135])
		: -1);
    }
    
    public void method2284() {
	for (int i = 0; i < 3; i++) {
	    if (((Class151_Sub2_Sub1) this).aLongArray11119[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11119[i]);
		((Class151_Sub2_Sub1) this).aLongArray11119[i] = 0L;
	    }
	}
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
    }
    
    public long method2029(int i, int i_27_) {
	return method10182(i, i_27_, null, null);
    }
    
    public void method2030(int i, int i_28_, int[] is, int[] is_29_) {
	method10182(i, i_28_, is, is_29_);
    }
    
    long method10182(int i, int i_30_, int[] is, int[] is_31_) {
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11135])
	    != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLongArray11119
			     [((Class151_Sub2_Sub1) this).anInt11135]);
	    ((Class151_Sub2_Sub1) this).aLongArray11119
		[((Class151_Sub2_Sub1) this).anInt11135]
		= 0L;
	}
	aByteBuffer9026.clear();
	IDirect3DSurface.Download((((Class151_Sub2_Sub1) this).aLongArray11133
				   [((Class151_Sub2_Sub1) this).anInt11135]),
				  0, 0, i, i_30_, i * 4, 0, aLong8955);
	if (++((Class151_Sub2_Sub1) this).anInt11135 >= 3)
	    ((Class151_Sub2_Sub1) this).anInt11135 = 0;
	if (is != null) {
	    aByteBuffer9026.asIntBuffer().get(is);
	    return 0L;
	}
	return aLong8955;
    }
    
    public void method2103(long l) {
	/* empty */
    }
    
    public void method2383() {
	if (((Class151_Sub2_Sub1) this).aLong11112 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11112);
	    ((Class151_Sub2_Sub1) this).aLong11112 = 0L;
	}
	for (int i = 0; i < 3; i++) {
	    if (((Class151_Sub2_Sub1) this).aLongArray11119[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11119[i]);
		((Class151_Sub2_Sub1) this).aLongArray11119[i] = 0L;
	    }
	    if (((Class151_Sub2_Sub1) this).aLongArray11133[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11133[i]);
		((Class151_Sub2_Sub1) this).aLongArray11133[i] = 0L;
	    }
	}
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
    }
    
    public Class136 method2266(Class136 class136, Class136 class136_32_,
			       float f, Class136 class136_33_) {
	return f < 0.5F ? class136 : class136_32_;
    }
    
    public void method2176(int i, int i_34_) {
	IDirect3DDevice.Clear(((Class151_Sub2_Sub1) this).aLong11097, i, i_34_,
			      1.0F, 0);
    }
    
    public Interface16 method2363(int i, int i_35_, int i_36_) {
	return new Class378(this, Class155.aClass155_1890, i, i_35_, i_36_);
    }
    
    void method2063() {
	super.finalize();
    }
    
    void method8272() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 174,
				   aBool9087);
    }
    
    final void method10183(long l) {
	((Class151_Sub2_Sub1) this).aLong11114 = l;
	IDirect3DDevice.SetVertexShader(((Class151_Sub2_Sub1) this).aLong11097,
					l);
    }
    
    final void method10184(long l) {
	IDirect3DDevice.SetPixelShader(((Class151_Sub2_Sub1) this).aLong11097,
				       l);
    }
    
    public void method8247(Class403 class403, Class403 class403_37_,
			   Class403 class403_38_) {
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097,
				     256, class403.aFloatArray4592);
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097, 2,
				     class403_37_.aFloatArray4592);
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097, 3,
				     class403_38_.aFloatArray4592);
    }
    
    public void method8280(Class403 class403) {
	class403.method4863(((Class151_Sub2_Sub1) this).aClass403_11127);
    }
    
    void method8290() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 7,
				   aBool8924);
    }
    
    void method8419() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 14,
				   aBool8973 && aBool9013);
    }
    
    void method8294() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       137, aBool8987 && !aBool9030);
    }
    
    public boolean method8378() {
	return ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.PixelShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    void method10185(Interface49 interface49) {
	Class487_Sub24 class487_sub24 = method10190(interface49);
	if (class487_sub24 != null)
	    class487_sub24.method5995((short) -10870);
    }
    
    void method8299() {
	method8363();
	method8264();
    }
    
    public boolean method2254() {
	return false;
    }
    
    void method8382() {
	int i;
	for (i = 0; i < anInt9008; i++) {
	    Class487_Sub16 class487_sub16 = aClass487_Sub16Array9003[i];
	    int i_39_ = i + 2;
	    int i_40_ = class487_sub16.method9179(-584524867);
	    float f = class487_sub16.method9174((byte) 119) / 255.0F;
	    D3DLIGHT.SetPosition(((Class151_Sub2_Sub1) this).aLong11131,
				 (float) class487_sub16.method9196(1663137988),
				 (float) class487_sub16.method9176(-973792760),
				 (float) class487_sub16.method9175(-64375987));
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11131,
				(float) (i_40_ >> 16 & 0xff) * f,
				(float) (i_40_ >> 8 & 0xff) * f,
				(float) (i_40_ & 0xff) * f, 0.0F);
	    D3DLIGHT.SetAttenuation
		(((Class151_Sub2_Sub1) this).aLong11131, 0.0F, 0.0F,
		 1.0F / (float) (class487_sub16.method9194((byte) 37)
				 * class487_sub16.method9194((byte) 57)));
	    D3DLIGHT.SetRange(((Class151_Sub2_Sub1) this).aLong11131,
			      (float) class487_sub16.method9194((byte) 19));
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097,
				     i_39_,
				     ((Class151_Sub2_Sub1) this).aLong11131);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					i_39_, true);
	}
	for (/**/; i < anInt9034; i++)
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					i + 2, false);
    }
    
    boolean method8302(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 3,
					method10193(class116, class155))));
    }
    
    Interface31 method8307(Class116 class116, Class155 class155, int i,
			   int i_41_) {
	return new Class383_Sub3(this, class116, class155, i, i_41_);
    }
    
    public void method2339(long l) {
	/* empty */
    }
    
    public long method2173(int i, int i_42_) {
	return method10182(i, i_42_, null, null);
    }
    
    Interface34 method8311(Class116 class116, Class155 class155, int i,
			   int i_43_) {
	return new Class383_Sub3_Sub1(this, class116, class155, i, i_43_);
    }
    
    Interface37 method8309(int i, boolean bool, int[][] is) {
	return new Class383_Sub2(this, i, bool, is);
    }
    
    static final int method10186(Class345 class345) {
	switch (class345.anInt3671) {
	case 4:
	    return 10;
	case 3:
	    return 26;
	case 0:
	    return 7;
	case 2:
	    return 2;
	case 1:
	    return 4;
	default:
	    throw new IllegalArgumentException();
	}
    }
    
    final void method10187(Class383 class383) {
	IDirect3DDevice.SetTexture(((Class151_Sub2_Sub1) this).aLong11097,
				   anInt9010, class383.method4633());
	if (aBool8921
	    && !((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]) {
	    ((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010] = true;
	    method8330();
	    method8287();
	}
    }
    
    final void method10188(Class383_Sub3 class383_sub3) {
	method10187(class383_sub3);
	if (((Class151_Sub2_Sub1) this).aBoolArray11106[anInt9010]
	    != ((Class383_Sub3) class383_sub3).aBool9971) {
	    IDirect3DDevice.SetSamplerState
		(((Class151_Sub2_Sub1) this).aLong11097, anInt9010, 1,
		 ((Class383_Sub3) class383_sub3).aBool9971 ? 1 : 3);
	    ((Class151_Sub2_Sub1) this).aBoolArray11106[anInt9010]
		= ((Class383_Sub3) class383_sub3).aBool9971;
	}
	if (((Class151_Sub2_Sub1) this).aBoolArray11134[anInt9010]
	    != ((Class383_Sub3) class383_sub3).aBool9973) {
	    IDirect3DDevice.SetSamplerState
		(((Class151_Sub2_Sub1) this).aLong11097, anInt9010, 2,
		 ((Class383_Sub3) class383_sub3).aBool9973 ? 1 : 3);
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[anInt9010]
		= ((Class383_Sub3) class383_sub3).aBool9973;
	}
    }
    
    final void method10189(Class383_Sub1 class383_sub1) {
	method10187(class383_sub1);
	if (!((Class151_Sub2_Sub1) this).aBoolArray11106[anInt9010]) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    anInt9010, 1, 1);
	    ((Class151_Sub2_Sub1) this).aBoolArray11106[anInt9010] = true;
	}
	if (!((Class151_Sub2_Sub1) this).aBoolArray11134[anInt9010]) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    anInt9010, 2, 1);
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[anInt9010] = true;
	}
    }
    
    Class487_Sub24 method10190(Interface49 interface49) {
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) -7515);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) -5)) {
	    if (class487_sub24.anObject10235 == interface49)
		return class487_sub24;
	}
	return null;
    }
    
    void method8328() {
	/* empty */
    }
    
    Interface37 method8453(int i, boolean bool, int[][] is) {
	return new Class383_Sub2(this, i, bool, is);
    }
    
    void method8414() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 174,
				   aBool9087);
    }
    
    void method8494(int i) {
	if (!((Class151_Sub2_Sub1) this).aBool11125) {
	    int i_44_ = (i & 0x2) != 0 ? 2 : 3;
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   8, i_44_);
	}
    }
    
    final void method8266(int i, Class338 class338, boolean bool) {
	if (aBool8921) {
	    int i_45_ = 0;
	    int i_46_;
	    switch (i) {
	    default:
		i_46_ = 5;
		break;
	    case 1:
		i_46_ = 6;
		break;
	    case 2:
		i_46_ = 27;
	    }
	    if (bool)
		i_45_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, i_46_,
						 (method10191(class338)
						  | i_45_));
	}
    }
    
    final void method8339() {
	if (aBool8921)
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   60, anInt9016);
    }
    
    void method8327() {
	if (((Class151_Sub2_Sub1) this).aLong11114 == 0L
	    && aClass340Array9031[anInt9010] != Class340.aClass340_3636) {
	    if (aClass340Array9031[anInt9010] == Class340.aClass340_3638)
		IDirect3DDevice.SetTransform
		    (((Class151_Sub2_Sub1) this).aLong11097, 16 + anInt9010,
		     (aClass403Array9033[anInt9010].method4913
		      (((Class151_Sub2_Sub1) this).aFloatArray11107)));
	    else
		IDirect3DDevice.SetTransform
		    (((Class151_Sub2_Sub1) this).aLong11097, 16 + anInt9010,
		     (aClass403Array9033[anInt9010].method4888
		      (((Class151_Sub2_Sub1) this).aFloatArray11107)));
	    int i = method10198(aClass340Array9031[anInt9010]);
	    if (i != ((Class151_Sub2_Sub1) this).anIntArray11111[anInt9010]) {
		IDirect3DDevice.SetTextureStageState(((Class151_Sub2_Sub1)
						      this).aLong11097,
						     anInt9010, 24, i);
		((Class151_Sub2_Sub1) this).anIntArray11111[anInt9010] = i;
	    }
	} else {
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 24, 0);
	    ((Class151_Sub2_Sub1) this).anIntArray11111[anInt9010] = 0;
	}
    }
    
    static final int method10191(Class338 class338) {
	switch (class338.anInt3624) {
	case 2:
	    return 1;
	default:
	    throw new IllegalArgumentException();
	case 3:
	    return 0;
	case 0:
	    return 3;
	case 1:
	    return 2;
	}
    }
    
    void method8487() {
	/* empty */
    }
    
    void method8334(int i) {
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       168, i);
    }
    
    public float method8401() {
	return -0.5F;
    }
    
    void method8432() {
	if (aBool8921) {
	    float f = aBool8990 ? aFloat9001 : 0.0F;
	    float f_47_ = aBool8990 ? -aFloat8986 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11102,
				f * aFloat8997, f * aFloat8998, f * aFloat8999,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11103,
				f_47_ * aFloat8997, f_47_ * aFloat8998,
				f_47_ * aFloat8999, 0.0F);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    public void method2153(boolean bool) {
	/* empty */
    }
    
    void method8441() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       28,
				       (aBool9080 && aBool9044
					&& anInt9047 >= 0));
    }
    
    void method8343() {
	aFloat9050 = aFloat8971 - (float) anInt9048;
	aFloat9049 = aFloat9050 - (float) anInt9047;
	if (aFloat9049 < aFloat8988)
	    aFloat9049 = aFloat8988;
	if (aBool8921) {
	    IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097,
				       36, aFloat9049);
	    IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097,
				       37, aFloat9050);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   34, anInt9046);
	}
    }
    
    void method8475() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 15,
				   aBool8972);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, aByte9056 & 0xff);
	if ((((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
	     .MultiSampleType)
	    > 0) {
	    if (!aBool8972 || aByte9056 == 0) {
		if (((Class151_Sub2_Sub1) this).aBool11098
		    || ((Class151_Sub2_Sub1) this).aBool11116)
		    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						    .aLong11097),
						   181, 0);
		else if (((Class151_Sub2_Sub1) this).aBool11121)
		    IDirect3DDevice.method9110((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154, 1.0F);
	    } else if (((Class151_Sub2_Sub1) this).aBool11098)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('S', 'S', 'A', 'A'));
	    else if (((Class151_Sub2_Sub1) this).aBool11116)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('A', 'T', 'O', 'C'));
	    else if (((Class151_Sub2_Sub1) this).aBool11121)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154,
					       method8355('A', '2', 'M', '1'));
	}
    }
    
    public int[] method2158(int i, int i_48_, int i_49_, int i_50_) {
	method2070();
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	long l_51_
	    = IDirect3DDevice.CreateRenderTarget((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 i_49_, i_50_, 21, 0, 0, true);
	int i_52_ = IDirect3DDevice.StretchRect((((Class151_Sub2_Sub1) this)
						 .aLong11097),
						l, i, i_48_, i_49_, i_50_,
						l_51_, 0, 0, i_49_, i_50_, 1);
	method8242(i_49_ * i_50_ * 4);
	if (Class326.method4295(i_52_)) {
	    is = new int[i_49_ * i_50_];
	    IDirect3DSurface.Download(l_51_, 0, 0, i_49_, i_50_, i_49_ * 4, 16,
				      aLong8955);
	    aByteBuffer9026.clear();
	    aByteBuffer9026.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_51_);
	return is;
    }
    
    public Class144_Sub2 method2320() {
	return new Class144_Sub2_Sub3_Sub1(this);
    }
    
    Class325 method8342(Class311[] class311s) {
	return new Class325_Sub2(this, class311s);
    }
    
    public void method8463(Class325 class325) {
	Class325_Sub2 class325_sub2 = (Class325_Sub2) class325;
	IDirect3DDevice.SetVertexDeclaration((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     (((Class325_Sub2) class325_sub2)
					      .aLong9834));
    }
    
    public void method8380(int i, Interface33 interface33) {
	Class376 class376 = (Class376) interface33;
	IDirect3DDevice.SetStreamSource(((Class151_Sub2_Sub1) this).aLong11097,
					i, ((Class376) class376).aLong4206, 0,
					class376.method4597());
    }
    
    public Interface16 method2020(int i, int i_53_, int i_54_) {
	return new Class378(this, Class155.aClass155_1890, i, i_53_, i_54_);
    }
    
    public final void method8462(Class342 class342, int i, int i_55_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawPrimitive(((Class151_Sub2_Sub1) this).aLong11097,
				      method10195(class342), i, i_55_);
    }
    
    Interface31 method8496(int i, int i_56_, boolean bool, int[] is, int i_57_,
			   int i_58_) {
	return new Class383_Sub3(this, i, i_56_, bool, is, i_57_, i_58_);
    }
    
    public final void method8351(Class342 class342, int i, int i_59_,
				 int i_60_, int i_61_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitive((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     method10195(class342), 0, i,
					     i_59_, i_60_, i_61_);
    }
    
    byte[] method10192(String string) {
	return method8246("dx", string);
    }
    
    public Class229 method8245(String string) {
	byte[] is = method10192(string);
	if (is == null)
	    return null;
	Class232 class232 = method8415(is);
	return new Class229_Sub2(this, class232);
    }
    
    public int[] method2156(int i, int i_62_, int i_63_, int i_64_) {
	method2070();
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	long l_65_
	    = IDirect3DDevice.CreateRenderTarget((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 i_63_, i_64_, 21, 0, 0, true);
	int i_66_ = IDirect3DDevice.StretchRect((((Class151_Sub2_Sub1) this)
						 .aLong11097),
						l, i, i_62_, i_63_, i_64_,
						l_65_, 0, 0, i_63_, i_64_, 1);
	method8242(i_63_ * i_64_ * 4);
	if (Class326.method4295(i_66_)) {
	    is = new int[i_63_ * i_64_];
	    IDirect3DSurface.Download(l_65_, 0, 0, i_63_, i_64_, i_63_ * 4, 16,
				      aLong8955);
	    aByteBuffer9026.clear();
	    aByteBuffer9026.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_65_);
	return is;
    }
    
    static final int method10193(Class116 class116, Class155 class155) {
	switch (class155.anInt1889 * 623902933) {
	case 4:
	    switch (class116.anInt1447 * 770769135) {
	    case 6:
		return Class239.anInt2659 * -1794468981;
	    case 3:
		return 28;
	    default:
		break;
	    case 4:
		return 50;
	    case 0:
		return Class239.anInt2660 * -740970381;
	    case 7:
		return 22;
	    case 5:
		return 77;
	    case 2:
		return 51;
	    case 9:
		return 21;
	    }
	    break;
	default:
	    break;
	case 7:
	    if (class116 == Class116.aClass116_1448)
		return 113;
	    break;
	case 1:
	    if (class116 == Class116.aClass116_1448)
		return 116;
	}
	throw new IllegalArgumentException("");
    }
    
    static final int method10194(Class155 class155) {
	if (class155 == Class155.aClass155_1885)
	    return 80;
	if (class155 == Class155.aClass155_1890)
	    return 77;
	throw new IllegalArgumentException("");
    }
    
    static final int method10195(Class342 class342) {
	switch (class342.anInt3646) {
	case 5:
	    return 6;
	case 3:
	    return 1;
	case 2:
	    return 4;
	case 1:
	    return 3;
	case 0:
	    return 5;
	case 4:
	    return 2;
	default:
	    throw new IllegalArgumentException("");
	}
    }
    
    void method8253() {
	method2383();
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) -24988);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) -86)) {
	    Interface49 interface49
		= (Interface49) class487_sub24.anObject10235;
	    interface49.method80();
	}
	super.method8253();
    }
    
    static boolean method10196(int i, int i_67_, long l, int i_68_,
			       D3DDISPLAYMODE d3ddisplaymode,
			       D3DPRESENT_PARAMETERS d3dpresent_parameters) {
	int i_69_ = 0;
	int i_70_ = 0;
	int i_71_ = 0;
	boolean bool;
	try {
	    if (Class326.method4294
		(IDirect3D.GetAdapterDisplayMode(l, i, d3ddisplaymode)))
		return false;
	while_51_:
	    for (/**/; i_68_ >= 0; i_68_--) {
		if (i_68_ != 1) {
		    i_71_ = 0 + i_68_;
		    for (int i_72_ = 0; i_72_ < anIntArray11113.length;
			 i_72_++) {
			if (IDirect3D.CheckDeviceType(l, i, i_67_,
						      d3ddisplaymode.Format,
						      anIntArray11113[i_72_],
						      true) == 0
			    && IDirect3D.CheckDeviceFormat(l, i, i_67_,
							   (d3ddisplaymode
							    .Format),
							   1, 1,
							   (anIntArray11113
							    [i_72_])) == 0
			    && (i_68_ == 0
				|| (IDirect3D.CheckDeviceMultiSampleType
				    (l, i, i_67_, anIntArray11113[i_72_], true,
				     i_71_)) == 0)) {
			    for (int i_73_ = 0; i_73_ < anIntArray11137.length;
				 i_73_++) {
				if ((IDirect3D.CheckDeviceFormat
				     (l, i, i_67_, d3ddisplaymode.Format, 2, 1,
				      anIntArray11137[i_73_])) == 0
				    && (IDirect3D.CheckDepthStencilMatch
					(l, i, i_67_, d3ddisplaymode.Format,
					 anIntArray11113[i_72_],
					 anIntArray11137[i_73_])) == 0
				    && (i_68_ == 0
					|| (IDirect3D
						.CheckDeviceMultiSampleType
					    (l, i, i_67_,
					     anIntArray11137[i_72_], true,
					     i_71_)) == 0)) {
				    i_70_ = anIntArray11113[i_72_];
				    i_69_ = anIntArray11137[i_73_];
				    break while_51_;
				}
			    }
			}
		    }
		}
	    }
	    if (i_68_ < 0 || i_70_ == 0 || i_69_ == 0)
		return false;
	    d3dpresent_parameters.BackBufferFormat = i_70_;
	    d3dpresent_parameters.AutoDepthStencilFormat = i_69_;
	    d3dpresent_parameters.MultiSampleType = i_71_;
	    d3dpresent_parameters.MultiSampleQuality = 0;
	    bool = true;
	} catch (Throwable throwable) {
	    return false;
	}
	return bool;
    }
    
    void method8405(int i) {
	if (!((Class151_Sub2_Sub1) this).aBool11125) {
	    int i_74_ = (i & 0x2) != 0 ? 2 : 3;
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   8, i_74_);
	}
    }
    
    public String method2005() {
	String string = "Caps: 4:";
	String string_75_ = ":";
	string = new StringBuilder().append(string).append(anInt9057).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append(anInt9063).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append(anInt8964).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9068 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (method8485() ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (method8378() ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9070 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9069 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11128 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11096 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11118 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11117 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9065 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9066 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9078 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11116 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11121 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11098 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9072 ? 1 : 0).append
		     (string_75_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11123 ? 1 : 0).append
		     (string_75_).toString();
	string
	    = new StringBuilder().append(string).append
		  (((Class151_Sub2_Sub1) this).aBool11124 ? 1 : 0).toString();
	return string;
    }
    
    Interface31 method8452(int i, int i_76_, boolean bool, int[] is, int i_77_,
			   int i_78_) {
	return new Class383_Sub3(this, i, i_76_, bool, is, i_77_, i_78_);
    }
    
    public void method2028(int i, int i_79_, int i_80_) {
	if (((Class151_Sub2_Sub1) this).aLong11112 == 0L)
	    method10181(i_79_, i_80_);
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	if (!Class326.method4294(IDirect3DDevice.StretchRect
				 (((Class151_Sub2_Sub1) this).aLong11097, l, 0,
				  0, aClass144_1857.method1943(),
				  aClass144_1857.method1944(),
				  ((Class151_Sub2_Sub1) this).aLong11112,
				  anInt1829 * 1882172349,
				  anInt1859 * 503204773,
				  anInt1830 * -1250842191,
				  anInt1861 * -750000687, 2))) {
	    /* empty */
	}
	IUnknown.Release(l);
	IDirect3DDevice.GetRenderTargetData
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class151_Sub2_Sub1) this).aLong11112,
	     (((Class151_Sub2_Sub1) this).aLongArray11133
	      [((Class151_Sub2_Sub1) this).anInt11136]));
	long l_81_
	    = IDirect3DDevice
		  .CreateEventQuery(((Class151_Sub2_Sub1) this).aLong11097);
	if (Class326.method4295(IDirect3DEventQuery.Issue(l_81_)))
	    ((Class151_Sub2_Sub1) this).aLongArray11119
		[((Class151_Sub2_Sub1) this).anInt11136]
		= l_81_;
	((Class151_Sub2_Sub1) this).anIntArray11132
	    [((Class151_Sub2_Sub1) this).anInt11136]
	    = i;
	if (++((Class151_Sub2_Sub1) this).anInt11136 >= 3)
	    ((Class151_Sub2_Sub1) this).anInt11136 = 0;
    }
    
    public Class127 method2120() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class151_Sub2_Sub1) this).aLong11126,
				       ((Class151_Sub2_Sub1) this).anInt11138,
				       0, d3dadapter_identifier);
	return new Class127(d3dadapter_identifier.VendorID,
			    method8241() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion, method8241());
    }
    
    void method2082(int i, int i_82_) throws Exception_Sub7 {
	if (((Class151_Sub2_Sub1) this).aBool11101) {
	    if (!method10180(aClass144_Sub1_1853.method1943(),
			     aClass144_Sub1_1853.method1944()))
		return;
	    ((Class144_Sub1_Sub1_Sub1) aClass144_Sub1_1853).method315();
	} else
	    IDirect3DDevice.EndScene(((Class151_Sub2_Sub1) this).aLong11097);
	int i_83_ = aClass144_Sub1_1853.method8234();
	if (Class326.method4294(i_83_)) {
	    ((Class151_Sub2_Sub1) this).aBool11101 = true;
	    aClass144_Sub1_1853.method80();
	} else {
	    IDirect3DDevice.BeginScene(((Class151_Sub2_Sub1) this).aLong11097);
	    if (anInterface19_1837 != null)
		anInterface19_1837.method86(-860202545);
	}
    }
    
    void method2122(int i, int i_84_) throws Exception_Sub7 {
	if (((Class151_Sub2_Sub1) this).aBool11101) {
	    if (!method10180(aClass144_Sub1_1853.method1943(),
			     aClass144_Sub1_1853.method1944()))
		return;
	    ((Class144_Sub1_Sub1_Sub1) aClass144_Sub1_1853).method315();
	} else
	    IDirect3DDevice.EndScene(((Class151_Sub2_Sub1) this).aLong11097);
	int i_85_ = aClass144_Sub1_1853.method8234();
	if (Class326.method4294(i_85_)) {
	    ((Class151_Sub2_Sub1) this).aBool11101 = true;
	    aClass144_Sub1_1853.method80();
	} else {
	    IDirect3DDevice.BeginScene(((Class151_Sub2_Sub1) this).aLong11097);
	    if (anInterface19_1837 != null)
		anInterface19_1837.method86(-1524979527);
	}
    }
    
    void method2386(int i, int i_86_) throws Exception_Sub7 {
	if (((Class151_Sub2_Sub1) this).aBool11101) {
	    if (!method10180(aClass144_Sub1_1853.method1943(),
			     aClass144_Sub1_1853.method1944()))
		return;
	    ((Class144_Sub1_Sub1_Sub1) aClass144_Sub1_1853).method315();
	} else
	    IDirect3DDevice.EndScene(((Class151_Sub2_Sub1) this).aLong11097);
	int i_87_ = aClass144_Sub1_1853.method8234();
	if (Class326.method4294(i_87_)) {
	    ((Class151_Sub2_Sub1) this).aBool11101 = true;
	    aClass144_Sub1_1853.method80();
	} else {
	    IDirect3DDevice.BeginScene(((Class151_Sub2_Sub1) this).aLong11097);
	    if (anInterface19_1837 != null)
		anInterface19_1837.method86(-820909588);
	}
    }
    
    public void method2124() {
	long l = IDirect3DDevice
		     .CreateEventQuery(((Class151_Sub2_Sub1) this).aLong11097);
	if (Class326.method4295(IDirect3DEventQuery.Issue(l))) {
	    for (;;) {
		int i = IDirect3DEventQuery.IsSignaled(l);
		if (i != 1)
		    break;
		Thread.yield();
	    }
	}
	IUnknown.Release(l);
    }
    
    public final synchronized void method2126(int i) {
	for (int i_88_ = 0; i_88_ < ((Class151_Sub2_Sub1) this).anInt11120;
	     i_88_++)
	    IUnknown
		.Release(((Class151_Sub2_Sub1) this).aLongArray11129[i_88_]);
	((Class151_Sub2_Sub1) this).anInt11120 = 0;
	super.method1993(i);
    }
    
    public String method2149() {
	String string = "Caps: 4:";
	String string_89_ = ":";
	string = new StringBuilder().append(string).append(anInt9057).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append(anInt9063).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append(anInt8964).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9068 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (method8485() ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (method8378() ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9070 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9069 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11128 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11096 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11118 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11117 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9065 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9066 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9078 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11116 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11121 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11098 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9072 ? 1 : 0).append
		     (string_89_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11123 ? 1 : 0).append
		     (string_89_).toString();
	string
	    = new StringBuilder().append(string).append
		  (((Class151_Sub2_Sub1) this).aBool11124 ? 1 : 0).toString();
	return string;
    }
    
    public void method2152(boolean bool) {
	/* empty */
    }
    
    void method8297() {
	if (aBool8921) {
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11102,
				  -aFloatArray8992[0], -aFloatArray8992[1],
				  -aFloatArray8992[2]);
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11103,
				  -aFloatArray9005[0], -aFloatArray9005[1],
				  -aFloatArray9005[2]);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    public void method2032(boolean bool) {
	/* empty */
    }
    
    void method8269() {
	switch (aClass337_9053.anInt3619) {
	case 3:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 5);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 6);
	    break;
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 9);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 2);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 1);
	    break;
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 2);
	    break;
	}
	switch (anInt8937) {
	case 2:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 2);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 2);
	    break;
	case 3:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 1);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 2);
	    break;
	case 0:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 1);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 1);
	    break;
	case 1:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 2);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 1);
	    break;
	}
    }
    
    void method8251() {
	for (int i = 0; i < anInt9063; i++) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 2, 1);
	    ((Class151_Sub2_Sub1) this).aClass313Array11110[i]
		= Class313.aClass313_3468;
	    boolean[] bools = ((Class151_Sub2_Sub1) this).aBoolArray11106;
	    int i_90_ = i;
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[i] = true;
	    bools[i_90_] = true;
	    ((Class151_Sub2_Sub1) this).aBoolArray11109[i] = false;
	    ((Class151_Sub2_Sub1) this).anIntArray11111[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, 0);
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 206,
				   aBool9072);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       181, 0);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       145, 1);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 38,
				   0.95F);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       35, 3);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 154,
				   1.0F);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11102, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11103, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11131, 1);
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	super.method8251();
    }
    
    public void method2004() {
	/* empty */
    }
    
    public boolean method2160() {
	return true;
    }
    
    public boolean method2161() {
	return true;
    }
    
    Interface31 method8422(Class116 class116, int i, int i_91_, boolean bool,
			   float[] fs, int i_92_, int i_93_) {
	return new Class383_Sub3(this, class116, i, i_91_, bool, fs, i_92_,
				 i_93_);
    }
    
    static {
	anIntArray11113 = new int[] { 22, 23 };
    }
    
    public boolean method2164() {
	return true;
    }
    
    public boolean method2165() {
	return false;
    }
    
    void method2329() {
	super.method2233();
	if (((Class151_Sub2_Sub1) this).aLong11102 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11102);
	    ((Class151_Sub2_Sub1) this).aLong11102 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11103 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11103);
	    ((Class151_Sub2_Sub1) this).aLong11103 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11131 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11131);
	    ((Class151_Sub2_Sub1) this).aLong11131 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11097 != 0L) {
	    IDirect3DDevice.Destroy(((Class151_Sub2_Sub1) this).aLong11097);
	    ((Class151_Sub2_Sub1) this).aLong11097 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11126 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11126);
	    ((Class151_Sub2_Sub1) this).aLong11126 = 0L;
	}
    }
    
    public int method2168() {
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11135])
	    == 0L)
	    return -1;
	return (Class326.method4295(IDirect3DEventQuery.IsSignaled
				    (((Class151_Sub2_Sub1) this)
				     .aLongArray11119
				     [((Class151_Sub2_Sub1) this).anInt11135]))
		? (((Class151_Sub2_Sub1) this).anIntArray11132
		   [((Class151_Sub2_Sub1) this).anInt11135])
		: -1);
    }
    
    public int method2169() {
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11135])
	    == 0L)
	    return -1;
	return (Class326.method4295(IDirect3DEventQuery.IsSignaled
				    (((Class151_Sub2_Sub1) this)
				     .aLongArray11119
				     [((Class151_Sub2_Sub1) this).anInt11135]))
		? (((Class151_Sub2_Sub1) this).anIntArray11132
		   [((Class151_Sub2_Sub1) this).anInt11135])
		: -1);
    }
    
    public boolean method8495() {
	return ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public void method2018(int i, int i_94_, int i_95_) {
	if (((Class151_Sub2_Sub1) this).aLong11112 == 0L)
	    method10181(i_94_, i_95_);
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	if (!Class326.method4294(IDirect3DDevice.StretchRect
				 (((Class151_Sub2_Sub1) this).aLong11097, l, 0,
				  0, aClass144_1857.method1943(),
				  aClass144_1857.method1944(),
				  ((Class151_Sub2_Sub1) this).aLong11112,
				  anInt1829 * 1882172349,
				  anInt1859 * 503204773,
				  anInt1830 * -1250842191,
				  anInt1861 * -750000687, 2))) {
	    /* empty */
	}
	IUnknown.Release(l);
	IDirect3DDevice.GetRenderTargetData
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class151_Sub2_Sub1) this).aLong11112,
	     (((Class151_Sub2_Sub1) this).aLongArray11133
	      [((Class151_Sub2_Sub1) this).anInt11136]));
	long l_96_
	    = IDirect3DDevice
		  .CreateEventQuery(((Class151_Sub2_Sub1) this).aLong11097);
	if (Class326.method4295(IDirect3DEventQuery.Issue(l_96_)))
	    ((Class151_Sub2_Sub1) this).aLongArray11119
		[((Class151_Sub2_Sub1) this).anInt11136]
		= l_96_;
	((Class151_Sub2_Sub1) this).anIntArray11132
	    [((Class151_Sub2_Sub1) this).anInt11136]
	    = i;
	if (++((Class151_Sub2_Sub1) this).anInt11136 >= 3)
	    ((Class151_Sub2_Sub1) this).anInt11136 = 0;
    }
    
    void method8295() {
	if (aBool8921) {
	    D3DLIGHT.SetAmbient(((Class151_Sub2_Sub1) this).aLong11102,
				aFloat8997 * aFloat9000,
				aFloat8998 * aFloat9000,
				aFloat8999 * aFloat9000, 0.0F);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8374() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 27,
				   aBool9054);
    }
    
    public long method2405(int i, int i_97_) {
	return method10182(i, i_97_, null, null);
    }
    
    Interface31 method8450(int i, int i_98_, boolean bool, int[] is, int i_99_,
			   int i_100_) {
	return new Class383_Sub3(this, i, i_98_, bool, is, i_99_, i_100_);
    }
    
    void method8486(Interface39 interface39) {
	IDirect3DDevice.SetIndices(((Class151_Sub2_Sub1) this).aLong11097,
				   (((Class385) (Class385) interface39)
				    .aLong4490));
    }
    
    public long method2177(int i, int i_101_) {
	return method10182(i, i_101_, null, null);
    }
    
    public Class136 method2281(Class136 class136, Class136 class136_102_,
			       float f, Class136 class136_103_) {
	return f < 0.5F ? class136 : class136_102_;
    }
    
    synchronized void method10197(long l) {
	if (((Class151_Sub2_Sub1) this).anInt11120
	    == ((Class151_Sub2_Sub1) this).anInt11094) {
	    ((Class151_Sub2_Sub1) this).anInt11094 *= 2;
	    long[] ls = new long[((Class151_Sub2_Sub1) this).anInt11094];
	    System.arraycopy(((Class151_Sub2_Sub1) this).aLongArray11129, 0,
			     ls, 0, ((Class151_Sub2_Sub1) this).anInt11120);
	    ((Class151_Sub2_Sub1) this).aLongArray11129 = ls;
	}
	((Class151_Sub2_Sub1) this).aLongArray11129
	    [((Class151_Sub2_Sub1) this).anInt11120]
	    = l;
	((Class151_Sub2_Sub1) this).anInt11120++;
    }
    
    public Class136 method2283(Class136 class136, Class136 class136_104_,
			       float f, Class136 class136_105_) {
	return f < 0.5F ? class136 : class136_104_;
    }
    
    public Class144_Sub2 method1986() {
	return new Class144_Sub2_Sub3_Sub1(this);
    }
    
    Class151_Sub2_Sub1
	(int i, int i_106_, long l, long l_107_, D3DDISPLAYMODE d3ddisplaymode,
	 D3DPRESENT_PARAMETERS d3dpresent_parameters, D3DCAPS d3dcaps,
	 Class140 class140, Interface19 interface19, Interface41 interface41,
	 Interface44 interface44, Interface43 interface43, Class411 class411,
	 int i_108_) {
	super(class140, interface19, interface41, interface44, interface43,
	      class411, i_108_, 0);
	((Class151_Sub2_Sub1) this).aLong11097 = 0L;
	((Class151_Sub2_Sub1) this).aClass656_11100 = new Class656();
	((Class151_Sub2_Sub1) this).aBool11101 = false;
	((Class151_Sub2_Sub1) this).aLong11102 = 0L;
	((Class151_Sub2_Sub1) this).aLong11103 = 0L;
	((Class151_Sub2_Sub1) this).aLong11131 = 0L;
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	((Class151_Sub2_Sub1) this).aFloatArray11107 = new float[16];
	((Class151_Sub2_Sub1) this).anInt11094 = 128;
	((Class151_Sub2_Sub1) this).anInt11120 = 0;
	((Class151_Sub2_Sub1) this).aLongArray11129
	    = new long[((Class151_Sub2_Sub1) this).anInt11094];
	((Class151_Sub2_Sub1) this).aLong11112 = 0L;
	((Class151_Sub2_Sub1) this).aLongArray11119 = new long[3];
	((Class151_Sub2_Sub1) this).aLongArray11133 = new long[3];
	((Class151_Sub2_Sub1) this).anIntArray11132 = new int[3];
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	try {
	    ((Class151_Sub2_Sub1) this).anInt11138 = i;
	    ((Class151_Sub2_Sub1) this).anInt11095 = i_106_;
	    ((Class151_Sub2_Sub1) this).aLong11126 = l;
	    ((Class151_Sub2_Sub1) this).aLong11097 = l_107_;
	    ((Class151_Sub2_Sub1) this).aD3DDISPLAYMODE11104 = d3ddisplaymode;
	    ((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		= d3dpresent_parameters;
	    ((Class151_Sub2_Sub1) this).aD3DCAPS11115 = d3dcaps;
	    ((Class151_Sub2_Sub1) this).aLong11102 = D3DLIGHT.Create();
	    ((Class151_Sub2_Sub1) this).aLong11103 = D3DLIGHT.Create();
	    ((Class151_Sub2_Sub1) this).aLong11131 = D3DLIGHT.Create();
	    anInt9063 = (((Class151_Sub2_Sub1) this).aD3DCAPS11115
			 .MaxSimultaneousTextures);
	    anInt8964
		= ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.MaxActiveLights
		    > 0)
		   ? ((Class151_Sub2_Sub1) this).aD3DCAPS11115.MaxActiveLights
		   : 8);
	    ((Class151_Sub2_Sub1) this).aBool11128
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.TextureCaps
		   & 0x2) == 0;
	    aBool9069 = (((Class151_Sub2_Sub1) this).aD3DCAPS11115.TextureCaps
			 & 0x800) != 0;
	    aBool9070 = (((Class151_Sub2_Sub1) this).aD3DCAPS11115.TextureCaps
			 & 0x2000) != 0;
	    ((Class151_Sub2_Sub1) this).aBool11096
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.TextureCaps
		   & 0x8000) != 0;
	    ((Class151_Sub2_Sub1) this).aBool11118
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.TextureCaps
		   & 0x10000) != 0;
	    ((Class151_Sub2_Sub1) this).aBool11117
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.TextureCaps
		   & 0x4000) != 0;
	    aBool9065
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.NumSimultaneousRTs
		   > 0);
	    aBool9071 = aBool9065;
	    aBool9066
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.NumSimultaneousRTs
		   > 0);
	    aBool9068
		= anInt9057 > 0 || (IDirect3D.CheckDeviceMultiSampleType
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     ((Class151_Sub2_Sub1) this).anInt11095,
				     (((Class151_Sub2_Sub1) this)
				      .aD3DPRESENT_PARAMETERS11122
				      .BackBufferFormat),
				     true, 2)) == 0;
	    aBool9078 = ((((Class151_Sub2_Sub1) this).aD3DCAPS11115
			  .NumSimultaneousRTs) > 0 && anInt9057 > 0
			 || (IDirect3D.CheckDeviceMultiSampleType
			     (((Class151_Sub2_Sub1) this).aLong11126,
			      ((Class151_Sub2_Sub1) this).anInt11138,
			      ((Class151_Sub2_Sub1) this).anInt11095, 113,
			      true, 2)) == 0);
	    ((Class151_Sub2_Sub1) this).aBool11116
		= (IDirect3D.CheckDeviceFormat
		   (((Class151_Sub2_Sub1) this).aLong11126,
		    ((Class151_Sub2_Sub1) this).anInt11138,
		    ((Class151_Sub2_Sub1) this).anInt11095,
		    (((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		     .BackBufferFormat),
		    0, 1, method8355('A', 'T', 'O', 'C'))) == 0;
	    ((Class151_Sub2_Sub1) this).aBool11121
		= (IDirect3D.CheckDeviceFormat
		   (((Class151_Sub2_Sub1) this).aLong11126,
		    ((Class151_Sub2_Sub1) this).anInt11138,
		    ((Class151_Sub2_Sub1) this).anInt11095,
		    (((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		     .BackBufferFormat),
		    0, 1, method8355('A', '2', 'M', '1'))) == 0;
	    ((Class151_Sub2_Sub1) this).aBool11098
		= (IDirect3D.CheckDeviceFormat
		   (((Class151_Sub2_Sub1) this).aLong11126,
		    ((Class151_Sub2_Sub1) this).anInt11138,
		    ((Class151_Sub2_Sub1) this).anInt11095,
		    (((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
		     .BackBufferFormat),
		    0, 1, method8355('S', 'S', 'A', 'A'))) == 0;
	    aBool9072
		= (((Class151_Sub2_Sub1) this).aD3DCAPS11115.PrimitiveMiscCaps
		   & 0x20000) != 0;
	    ((Class151_Sub2_Sub1) this).aBool11123
		= (IDirect3D.CheckDeviceFormat
		   (((Class151_Sub2_Sub1) this).aLong11126,
		    ((Class151_Sub2_Sub1) this).anInt11138,
		    ((Class151_Sub2_Sub1) this).anInt11095,
		    ((Class151_Sub2_Sub1) this).aD3DDISPLAYMODE11104.Format,
		    524288, 3, 113)) == 0;
	    ((Class151_Sub2_Sub1) this).aBool11124
		= (IDirect3D.CheckDeviceFormat
		   (((Class151_Sub2_Sub1) this).aLong11126,
		    ((Class151_Sub2_Sub1) this).anInt11138,
		    ((Class151_Sub2_Sub1) this).anInt11095,
		    ((Class151_Sub2_Sub1) this).aD3DDISPLAYMODE11104.Format,
		    524288, 3, 116)) == 0;
	    ((Class151_Sub2_Sub1) this).aBoolArray11106
		= new boolean[anInt9063];
	    ((Class151_Sub2_Sub1) this).aBoolArray11134
		= new boolean[anInt9063];
	    ((Class151_Sub2_Sub1) this).aBoolArray11108
		= new boolean[anInt9063];
	    ((Class151_Sub2_Sub1) this).aClass313Array11110
		= new Class313[anInt9063];
	    ((Class151_Sub2_Sub1) this).aBoolArray11109
		= new boolean[anInt9063];
	    ((Class151_Sub2_Sub1) this).anIntArray11111 = new int[anInt9063];
	    Class400 class400 = new Class400();
	    class400.method4816(1.0F, -1.0F, 0.5F);
	    class400.method4819(0.0F, 0.0F, 0.5F);
	    ((Class151_Sub2_Sub1) this).aClass403_11127 = new Class403();
	    ((Class151_Sub2_Sub1) this).aClass403_11127.method4865(class400);
	    IDirect3DDevice.BeginScene(((Class151_Sub2_Sub1) this).aLong11097);
	} catch (Throwable throwable) {
	    throwable.printStackTrace();
	    method2078(-2008818111);
	    throw new RuntimeException("");
	}
    }
    
    void method8413() {
	IDirect3DDevice.SetScissorRect(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt8984 + anInt8974,
				       anInt8995 + anInt8943, anInt8975,
				       anInt8928);
    }
    
    public Class144_Sub2 method2322() {
	return new Class144_Sub2_Sub3_Sub1(this);
    }
    
    public Class144_Sub2 method2288() {
	return new Class144_Sub2_Sub3_Sub1(this);
    }
    
    final Interface39 method8377(boolean bool) {
	return new Class385(this, Class155.aClass155_1885, bool);
    }
    
    public Interface18 method2112(int i, int i_109_, Class116 class116,
				  Class155 class155, int i_110_) {
	return new Class390(this, class116, class155, i, i_109_, i_110_);
    }
    
    void method8318() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 15,
				   aBool8972);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, aByte9056 & 0xff);
	if ((((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
	     .MultiSampleType)
	    > 0) {
	    if (!aBool8972 || aByte9056 == 0) {
		if (((Class151_Sub2_Sub1) this).aBool11098
		    || ((Class151_Sub2_Sub1) this).aBool11116)
		    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						    .aLong11097),
						   181, 0);
		else if (((Class151_Sub2_Sub1) this).aBool11121)
		    IDirect3DDevice.method9110((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154, 1.0F);
	    } else if (((Class151_Sub2_Sub1) this).aBool11098)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('S', 'S', 'A', 'A'));
	    else if (((Class151_Sub2_Sub1) this).aBool11116)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('A', 'T', 'O', 'C'));
	    else if (((Class151_Sub2_Sub1) this).aBool11121)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154,
					       method8355('A', '2', 'M', '1'));
	}
    }
    
    public final synchronized void method2125(int i) {
	for (int i_111_ = 0; i_111_ < ((Class151_Sub2_Sub1) this).anInt11120;
	     i_111_++)
	    IUnknown
		.Release(((Class151_Sub2_Sub1) this).aLongArray11129[i_111_]);
	((Class151_Sub2_Sub1) this).anInt11120 = 0;
	super.method1993(i);
    }
    
    void method2272() {
	super.finalize();
    }
    
    void method2052() {
	super.method2233();
	if (((Class151_Sub2_Sub1) this).aLong11102 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11102);
	    ((Class151_Sub2_Sub1) this).aLong11102 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11103 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11103);
	    ((Class151_Sub2_Sub1) this).aLong11103 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11131 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11131);
	    ((Class151_Sub2_Sub1) this).aLong11131 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11097 != 0L) {
	    IDirect3DDevice.Destroy(((Class151_Sub2_Sub1) this).aLong11097);
	    ((Class151_Sub2_Sub1) this).aLong11097 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11126 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11126);
	    ((Class151_Sub2_Sub1) this).aLong11126 = 0L;
	}
    }
    
    public int[] method2157(int i, int i_112_, int i_113_, int i_114_) {
	method2070();
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	long l_115_
	    = IDirect3DDevice.CreateRenderTarget((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 i_113_, i_114_, 21, 0, 0,
						 true);
	int i_116_
	    = IDirect3DDevice.StretchRect((((Class151_Sub2_Sub1) this)
					   .aLong11097),
					  l, i, i_112_, i_113_, i_114_, l_115_,
					  0, 0, i_113_, i_114_, 1);
	method8242(i_113_ * i_114_ * 4);
	if (Class326.method4295(i_116_)) {
	    is = new int[i_113_ * i_114_];
	    IDirect3DSurface.Download(l_115_, 0, 0, i_113_, i_114_, i_113_ * 4,
				      16, aLong8955);
	    aByteBuffer9026.clear();
	    aByteBuffer9026.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_115_);
	return is;
    }
    
    final Interface39 method8341(boolean bool) {
	return new Class385(this, Class155.aClass155_1885, bool);
    }
    
    public int method2167() {
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11135])
	    == 0L)
	    return -1;
	return (Class326.method4295(IDirect3DEventQuery.IsSignaled
				    (((Class151_Sub2_Sub1) this)
				     .aLongArray11119
				     [((Class151_Sub2_Sub1) this).anInt11135]))
		? (((Class151_Sub2_Sub1) this).anIntArray11132
		   [((Class151_Sub2_Sub1) this).anInt11135])
		: -1);
    }
    
    Class144_Sub1 method2332(Canvas canvas, int i, int i_117_) {
	return new Class144_Sub1_Sub1_Sub1(this, canvas, i, i_117_, false);
    }
    
    void method8398() {
	method2383();
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) 1577);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) -117)) {
	    Interface49 interface49
		= (Interface49) class487_sub24.anObject10235;
	    interface49.method80();
	}
	super.method8253();
    }
    
    void method8478() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       28,
				       (aBool9080 && aBool9044
					&& anInt9047 >= 0));
    }
    
    public boolean method2335() {
	if (((Class151_Sub2_Sub1) this).aBool11101)
	    return false;
	if ((((Class151_Sub2_Sub1) this).aLongArray11119
	     [((Class151_Sub2_Sub1) this).anInt11136])
	    != 0L)
	    return false;
	return true;
    }
    
    public void method2336(int i, int i_118_, int[] is, int[] is_119_) {
	method10182(i, i_118_, is, is_119_);
    }
    
    public void method2357(int i, int i_120_, int[] is, int[] is_121_) {
	method10182(i, i_120_, is, is_121_);
    }
    
    public void method2338(long l) {
	/* empty */
    }
    
    final Interface39 method8359(boolean bool) {
	return new Class385(this, Class155.aClass155_1885, bool);
    }
    
    void method8335() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 15,
				   aBool8972);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, aByte9056 & 0xff);
	if ((((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
	     .MultiSampleType)
	    > 0) {
	    if (!aBool8972 || aByte9056 == 0) {
		if (((Class151_Sub2_Sub1) this).aBool11098
		    || ((Class151_Sub2_Sub1) this).aBool11116)
		    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						    .aLong11097),
						   181, 0);
		else if (((Class151_Sub2_Sub1) this).aBool11121)
		    IDirect3DDevice.method9110((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154, 1.0F);
	    } else if (((Class151_Sub2_Sub1) this).aBool11098)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('S', 'S', 'A', 'A'));
	    else if (((Class151_Sub2_Sub1) this).aBool11116)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('A', 'T', 'O', 'C'));
	    else if (((Class151_Sub2_Sub1) this).aBool11121)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154,
					       method8355('A', '2', 'M', '1'));
	}
    }
    
    public void method2341(long l) {
	/* empty */
    }
    
    public void method8483(Class325 class325) {
	Class325_Sub2 class325_sub2 = (Class325_Sub2) class325;
	IDirect3DDevice.SetVertexDeclaration((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     (((Class325_Sub2) class325_sub2)
					      .aLong9834));
    }
    
    public void method2343() {
	if (((Class151_Sub2_Sub1) this).aLong11112 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11112);
	    ((Class151_Sub2_Sub1) this).aLong11112 = 0L;
	}
	for (int i = 0; i < 3; i++) {
	    if (((Class151_Sub2_Sub1) this).aLongArray11119[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11119[i]);
		((Class151_Sub2_Sub1) this).aLongArray11119[i] = 0L;
	    }
	    if (((Class151_Sub2_Sub1) this).aLongArray11133[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11133[i]);
		((Class151_Sub2_Sub1) this).aLongArray11133[i] = 0L;
	    }
	}
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
    }
    
    public void method2344() {
	if (((Class151_Sub2_Sub1) this).aLong11112 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11112);
	    ((Class151_Sub2_Sub1) this).aLong11112 = 0L;
	}
	for (int i = 0; i < 3; i++) {
	    if (((Class151_Sub2_Sub1) this).aLongArray11119[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11119[i]);
		((Class151_Sub2_Sub1) this).aLongArray11119[i] = 0L;
	    }
	    if (((Class151_Sub2_Sub1) this).aLongArray11133[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11133[i]);
		((Class151_Sub2_Sub1) this).aLongArray11133[i] = 0L;
	    }
	}
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
    }
    
    public void method2345() {
	if (((Class151_Sub2_Sub1) this).aLong11112 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11112);
	    ((Class151_Sub2_Sub1) this).aLong11112 = 0L;
	}
	for (int i = 0; i < 3; i++) {
	    if (((Class151_Sub2_Sub1) this).aLongArray11119[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11119[i]);
		((Class151_Sub2_Sub1) this).aLongArray11119[i] = 0L;
	    }
	    if (((Class151_Sub2_Sub1) this).aLongArray11133[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11133[i]);
		((Class151_Sub2_Sub1) this).aLongArray11133[i] = 0L;
	    }
	}
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
    }
    
    public Interface16 method2362(int i, int i_122_, int i_123_) {
	return new Class378(this, Class155.aClass155_1890, i, i_122_, i_123_);
    }
    
    public void method2118(boolean bool) {
	/* empty */
    }
    
    public Interface16 method2364(int i, int i_124_, int i_125_) {
	return new Class378(this, Class155.aClass155_1890, i, i_124_, i_125_);
    }
    
    public boolean method8383() {
	return ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.PixelShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public boolean method8384(boolean bool) {
	if (bool)
	    return ((Class151_Sub2_Sub1) this).aBool11123;
	return (((Class151_Sub2_Sub1) this).aBool11123
		&& ((Class151_Sub2_Sub1) this).aBool11124);
    }
    
    public Class229 method8329(String string) {
	byte[] is = method10192(string);
	if (is == null)
	    return null;
	Class232 class232 = method8415(is);
	return new Class229_Sub2(this, class232);
    }
    
    public Class229 method8267(String string) {
	byte[] is = method10192(string);
	if (is == null)
	    return null;
	Class232 class232 = method8415(is);
	return new Class229_Sub2(this, class232);
    }
    
    public Class229 method8387(String string) {
	byte[] is = method10192(string);
	if (is == null)
	    return null;
	Class232 class232 = method8415(is);
	return new Class229_Sub2(this, class232);
    }
    
    public void method8312(Class403 class403, Class403 class403_126_,
			   Class403 class403_127_) {
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097,
				     256, class403.aFloatArray4592);
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097, 2,
				     class403_126_.aFloatArray4592);
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097, 3,
				     class403_127_.aFloatArray4592);
    }
    
    public void method8416(Class403 class403, Class403 class403_128_,
			   Class403 class403_129_) {
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097,
				     256, class403.aFloatArray4592);
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097, 2,
				     class403_128_.aFloatArray4592);
	IDirect3DDevice.SetTransform(((Class151_Sub2_Sub1) this).aLong11097, 3,
				     class403_129_.aFloatArray4592);
    }
    
    void method8340(boolean bool) {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 161,
				   bool);
    }
    
    void method8403() {
	for (int i = 0; i < anInt9063; i++) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 2, 1);
	    ((Class151_Sub2_Sub1) this).aClass313Array11110[i]
		= Class313.aClass313_3468;
	    boolean[] bools = ((Class151_Sub2_Sub1) this).aBoolArray11106;
	    int i_130_ = i;
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[i] = true;
	    bools[i_130_] = true;
	    ((Class151_Sub2_Sub1) this).aBoolArray11109[i] = false;
	    ((Class151_Sub2_Sub1) this).anIntArray11111[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, 0);
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 206,
				   aBool9072);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       181, 0);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       145, 1);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 38,
				   0.95F);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       35, 3);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 154,
				   1.0F);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11102, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11103, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11131, 1);
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	super.method8251();
    }
    
    void method8277() {
	for (int i = 0; i < anInt9063; i++) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 2, 1);
	    ((Class151_Sub2_Sub1) this).aClass313Array11110[i]
		= Class313.aClass313_3468;
	    boolean[] bools = ((Class151_Sub2_Sub1) this).aBoolArray11106;
	    int i_131_ = i;
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[i] = true;
	    bools[i_131_] = true;
	    ((Class151_Sub2_Sub1) this).aBoolArray11109[i] = false;
	    ((Class151_Sub2_Sub1) this).anIntArray11111[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, 0);
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 206,
				   aBool9072);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       181, 0);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       145, 1);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 38,
				   0.95F);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       35, 3);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 154,
				   1.0F);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11102, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11103, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11131, 1);
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	super.method8251();
    }
    
    void method8393() {
	for (int i = 0; i < anInt9063; i++) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 2, 1);
	    ((Class151_Sub2_Sub1) this).aClass313Array11110[i]
		= Class313.aClass313_3468;
	    boolean[] bools = ((Class151_Sub2_Sub1) this).aBoolArray11106;
	    int i_132_ = i;
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[i] = true;
	    bools[i_132_] = true;
	    ((Class151_Sub2_Sub1) this).aBoolArray11109[i] = false;
	    ((Class151_Sub2_Sub1) this).anIntArray11111[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, 0);
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 206,
				   aBool9072);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       181, 0);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       145, 1);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 38,
				   0.95F);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       35, 3);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 154,
				   1.0F);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11102, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11103, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11131, 1);
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	super.method8251();
    }
    
    void method8394() {
	for (int i = 0; i < anInt9063; i++) {
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 7, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 6, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 5, 2);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 1, 1);
	    IDirect3DDevice.SetSamplerState((((Class151_Sub2_Sub1) this)
					     .aLong11097),
					    i, 2, 1);
	    ((Class151_Sub2_Sub1) this).aClass313Array11110[i]
		= Class313.aClass313_3468;
	    boolean[] bools = ((Class151_Sub2_Sub1) this).aBoolArray11106;
	    int i_133_ = i;
	    ((Class151_Sub2_Sub1) this).aBoolArray11134[i] = true;
	    bools[i_133_] = true;
	    ((Class151_Sub2_Sub1) this).aBoolArray11109[i] = false;
	    ((Class151_Sub2_Sub1) this).anIntArray11111[i] = 0;
	}
	IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     0, 6, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       9, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       23, 4);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       25, 5);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, 0);
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 206,
				   aBool9072);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       181, 0);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       22, 2);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       147, 1);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       145, 1);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 38,
				   0.95F);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       35, 3);
	IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097, 154,
				   1.0F);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11102, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11103, 3);
	D3DLIGHT.SetType(((Class151_Sub2_Sub1) this).aLong11131, 1);
	((Class151_Sub2_Sub1) this).aBool11105 = false;
	super.method8251();
    }
    
    void method8303() {
	method2383();
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) 11644);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) -1)) {
	    Interface49 interface49
		= (Interface49) class487_sub24.anObject10235;
	    interface49.method80();
	}
	super.method8253();
    }
    
    void method8337() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 27,
				   aBool9054);
    }
    
    final Interface33 method8480(boolean bool) {
	return new Class376(this, bool);
    }
    
    void method8399() {
	for (Class487_Sub24 class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7795((short) 12565);
	     class487_sub24 != null;
	     class487_sub24
		 = (Class487_Sub24) ((Class151_Sub2_Sub1) this)
					.aClass656_11100
					.method7798((byte) -83)) {
	    Interface49 interface49
		= (Interface49) class487_sub24.anObject10235;
	    interface49.method315();
	    if (interface49 == aClass144_1857)
		interface49.method320();
	}
	super.method8388();
    }
    
    public Interface16 method2326(int i, int i_134_) {
	return new Class378(this, Class155.aClass155_1890, i, i_134_, 0);
    }
    
    void method8408() {
	if (aClass144_1857 != null)
	    IDirect3DDevice.SetViewport(((Class151_Sub2_Sub1) this).aLong11097,
					anInt8984 + anInt8981,
					anInt8995 + anInt9002, anInt9062,
					anInt8983, aFloat8966, aFloat9004);
    }
    
    void method8409() {
	if (aClass144_1857 != null)
	    IDirect3DDevice.SetViewport(((Class151_Sub2_Sub1) this).aLong11097,
					anInt8984 + anInt8981,
					anInt8995 + anInt9002, anInt9062,
					anInt8983, aFloat8966, aFloat9004);
    }
    
    void method8410() {
	IDirect3DDevice.SetScissorRect(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt8984 + anInt8974,
				       anInt8995 + anInt8943, anInt8975,
				       anInt8928);
    }
    
    void method8411() {
	IDirect3DDevice.SetScissorRect(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt8984 + anInt8974,
				       anInt8995 + anInt8943, anInt8975,
				       anInt8928);
    }
    
    final void method8258() {
	if (aBool8921)
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   60, anInt9016);
    }
    
    final void method8319(int i, Class338 class338, boolean bool,
			  boolean bool_135_) {
	if (aBool8921) {
	    int i_136_ = 0;
	    int i_137_;
	    switch (i) {
	    default:
		i_137_ = 2;
		break;
	    case 2:
		i_137_ = 26;
		break;
	    case 1:
		i_137_ = 3;
	    }
	    if (bool)
		i_136_ |= 0x20;
	    if (bool_135_)
		i_136_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, i_137_,
						 (method10191(class338)
						  | i_136_));
	}
    }
    
    Interface31 method8270(Class116 class116, int i, int i_138_, boolean bool,
			   byte[] is, int i_139_, int i_140_) {
	return new Class383_Sub3(this, class116, i, i_138_, bool, is, i_139_,
				 i_140_);
    }
    
    public float method8400() {
	return -0.5F;
    }
    
    void method8423() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 7,
				   aBool8924);
    }
    
    public int[] method2155(int i, int i_141_, int i_142_, int i_143_) {
	method2070();
	int[] is = null;
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	long l_144_
	    = IDirect3DDevice.CreateRenderTarget((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 i_142_, i_143_, 21, 0, 0,
						 true);
	int i_145_
	    = IDirect3DDevice.StretchRect((((Class151_Sub2_Sub1) this)
					   .aLong11097),
					  l, i, i_141_, i_142_, i_143_, l_144_,
					  0, 0, i_142_, i_143_, 1);
	method8242(i_142_ * i_143_ * 4);
	if (Class326.method4295(i_145_)) {
	    is = new int[i_142_ * i_143_];
	    IDirect3DSurface.Download(l_144_, 0, 0, i_142_, i_143_, i_142_ * 4,
				      16, aLong8955);
	    aByteBuffer9026.clear();
	    aByteBuffer9026.asIntBuffer().get(is);
	}
	IUnknown.Release(l);
	IUnknown.Release(l_144_);
	return is;
    }
    
    void method8425() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 14,
				   aBool8973 && aBool9013);
    }
    
    void method8426() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 14,
				   aBool8973 && aBool9013);
    }
    
    void method8376() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 14,
				   aBool8973 && aBool9013);
    }
    
    void method8427() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       137, aBool8987 && !aBool9030);
    }
    
    void method8428() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       137, aBool8987 && !aBool9030);
    }
    
    void method8429() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       137, aBool8987 && !aBool9030);
    }
    
    void method8430() {
	if (aBool8921)
	    IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097,
				       137, aBool8987 && !aBool9030);
    }
    
    Interface31 method8448(Class116 class116, int i, int i_146_, boolean bool,
			   float[] fs, int i_147_, int i_148_) {
	return new Class383_Sub3(this, class116, i, i_146_, bool, fs, i_147_,
				 i_148_);
    }
    
    void method8431() {
	if (aBool8921) {
	    float f = aBool8990 ? aFloat9001 : 0.0F;
	    float f_149_ = aBool8990 ? -aFloat8986 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11102,
				f * aFloat8997, f * aFloat8998, f * aFloat8999,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11103,
				f_149_ * aFloat8997, f_149_ * aFloat8998,
				f_149_ * aFloat8999, 0.0F);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8363() {
	if (aBool8921) {
	    float f = aBool8990 ? aFloat9001 : 0.0F;
	    float f_150_ = aBool8990 ? -aFloat8986 : 0.0F;
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11102,
				f * aFloat8997, f * aFloat8998, f * aFloat8999,
				0.0F);
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11103,
				f_150_ * aFloat8997, f_150_ * aFloat8998,
				f_150_ * aFloat8999, 0.0F);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8282() {
	if (aBool8921) {
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11102,
				  -aFloatArray8992[0], -aFloatArray8992[1],
				  -aFloatArray8992[2]);
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11103,
				  -aFloatArray9005[0], -aFloatArray9005[1],
				  -aFloatArray9005[2]);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8352() {
	if (aBool8921) {
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11102,
				  -aFloatArray8992[0], -aFloatArray8992[1],
				  -aFloatArray8992[2]);
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11103,
				  -aFloatArray9005[0], -aFloatArray9005[1],
				  -aFloatArray9005[2]);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8434() {
	if (aBool8921) {
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11102,
				  -aFloatArray8992[0], -aFloatArray8992[1],
				  -aFloatArray8992[2]);
	    D3DLIGHT.SetDirection(((Class151_Sub2_Sub1) this).aLong11103,
				  -aFloatArray9005[0], -aFloatArray9005[1],
				  -aFloatArray9005[2]);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8435() {
	if (aBool8921 && !((Class151_Sub2_Sub1) this).aBool11105) {
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					0, false);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					1, false);
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097, 0,
				     ((Class151_Sub2_Sub1) this).aLong11102);
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097, 1,
				     ((Class151_Sub2_Sub1) this).aLong11103);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					0, true);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					1, true);
	    ((Class151_Sub2_Sub1) this).aBool11105 = true;
	}
    }
    
    void method8436() {
	method8363();
	method8264();
    }
    
    void method8437() {
	method8363();
	method8264();
    }
    
    void method8354() {
	int i;
	for (i = 0; i < anInt9008; i++) {
	    Class487_Sub16 class487_sub16 = aClass487_Sub16Array9003[i];
	    int i_151_ = i + 2;
	    int i_152_ = class487_sub16.method9179(1818702975);
	    float f = class487_sub16.method9174((byte) 96) / 255.0F;
	    D3DLIGHT.SetPosition(((Class151_Sub2_Sub1) this).aLong11131,
				 (float) class487_sub16.method9196(1841259843),
				 (float) class487_sub16.method9176(-596115194),
				 (float) class487_sub16.method9175(-64375987));
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11131,
				(float) (i_152_ >> 16 & 0xff) * f,
				(float) (i_152_ >> 8 & 0xff) * f,
				(float) (i_152_ & 0xff) * f, 0.0F);
	    D3DLIGHT.SetAttenuation
		(((Class151_Sub2_Sub1) this).aLong11131, 0.0F, 0.0F,
		 1.0F / (float) (class487_sub16.method9194((byte) 70)
				 * class487_sub16.method9194((byte) 5)));
	    D3DLIGHT.SetRange(((Class151_Sub2_Sub1) this).aLong11131,
			      (float) class487_sub16.method9194((byte) 113));
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097,
				     i_151_,
				     ((Class151_Sub2_Sub1) this).aLong11131);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					i_151_, true);
	}
	for (/**/; i < anInt9034; i++)
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					i + 2, false);
    }
    
    void method8439() {
	int i;
	for (i = 0; i < anInt9008; i++) {
	    Class487_Sub16 class487_sub16 = aClass487_Sub16Array9003[i];
	    int i_153_ = i + 2;
	    int i_154_ = class487_sub16.method9179(-1352417984);
	    float f = class487_sub16.method9174((byte) 82) / 255.0F;
	    D3DLIGHT.SetPosition(((Class151_Sub2_Sub1) this).aLong11131,
				 (float) class487_sub16.method9196(1608152874),
				 (float) class487_sub16
					     .method9176(-1982837245),
				 (float) class487_sub16.method9175(-64375987));
	    D3DLIGHT.SetDiffuse(((Class151_Sub2_Sub1) this).aLong11131,
				(float) (i_154_ >> 16 & 0xff) * f,
				(float) (i_154_ >> 8 & 0xff) * f,
				(float) (i_154_ & 0xff) * f, 0.0F);
	    D3DLIGHT.SetAttenuation
		(((Class151_Sub2_Sub1) this).aLong11131, 0.0F, 0.0F,
		 1.0F / (float) (class487_sub16.method9194((byte) 84)
				 * class487_sub16.method9194((byte) 28)));
	    D3DLIGHT.SetRange(((Class151_Sub2_Sub1) this).aLong11131,
			      (float) class487_sub16.method9194((byte) 113));
	    IDirect3DDevice.SetLight(((Class151_Sub2_Sub1) this).aLong11097,
				     i_153_,
				     ((Class151_Sub2_Sub1) this).aLong11131);
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					i_153_, true);
	}
	for (/**/; i < anInt9034; i++)
	    IDirect3DDevice.LightEnable(((Class151_Sub2_Sub1) this).aLong11097,
					i + 2, false);
    }
    
    boolean method8293(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 3,
					method10193(class116, class155))));
    }
    
    final Interface33 method8289(boolean bool) {
	return new Class376(this, bool);
    }
    
    boolean method8440(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 4,
					method10193(class116, class155))));
    }
    
    boolean method8445(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 4,
					method10193(class116, class155))));
    }
    
    boolean method8298(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 4,
					method10193(class116, class155))));
    }
    
    boolean method8443(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 4,
					method10193(class116, class155))));
    }
    
    boolean method8444(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 4,
					method10193(class116, class155))));
    }
    
    Interface31 method8433(Class116 class116, Class155 class155, int i,
			   int i_155_) {
	return new Class383_Sub3(this, class116, class155, i, i_155_);
    }
    
    Interface31 method8446(Class116 class116, int i, int i_156_, boolean bool,
			   byte[] is, int i_157_, int i_158_) {
	return new Class383_Sub3(this, class116, i, i_156_, bool, is, i_157_,
				 i_158_);
    }
    
    Interface31 method8406(Class116 class116, int i, int i_159_, boolean bool,
			   byte[] is, int i_160_, int i_161_) {
	return new Class383_Sub3(this, class116, i, i_159_, bool, is, i_160_,
				 i_161_);
    }
    
    Interface31 method8345(Class116 class116, int i, int i_162_, boolean bool,
			   byte[] is, int i_163_, int i_164_) {
	return new Class383_Sub3(this, class116, i, i_162_, bool, is, i_163_,
				 i_164_);
    }
    
    Interface31 method8447(Class116 class116, int i, int i_165_, boolean bool,
			   float[] fs, int i_166_, int i_167_) {
	return new Class383_Sub3(this, class116, i, i_165_, bool, fs, i_166_,
				 i_167_);
    }
    
    static final int method10198(Class340 class340) {
	switch (class340.anInt3632) {
	case 5:
	    return 4;
	case 1:
	    return 1;
	case 0:
	    return 256;
	default:
	    return 0;
	case 2:
	    return 2;
	case 4:
	    return 3;
	}
    }
    
    Interface31 method8449(int i, int i_168_, boolean bool, int[] is,
			   int i_169_, int i_170_) {
	return new Class383_Sub3(this, i, i_168_, bool, is, i_169_, i_170_);
    }
    
    Class325 method8482(Class311[] class311s) {
	return new Class325_Sub2(this, class311s);
    }
    
    Interface31 method8451(int i, int i_171_, boolean bool, int[] is,
			   int i_172_, int i_173_) {
	return new Class383_Sub3(this, i, i_171_, bool, is, i_172_, i_173_);
    }
    
    void method8442() {
	if (aBool8921) {
	    int i = (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]
		     ? method10186(aClass345Array8917[anInt9010]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 4, i);
	}
    }
    
    public final synchronized void method1993(int i) {
	for (int i_174_ = 0; i_174_ < ((Class151_Sub2_Sub1) this).anInt11120;
	     i_174_++)
	    IUnknown
		.Release(((Class151_Sub2_Sub1) this).aLongArray11129[i_174_]);
	((Class151_Sub2_Sub1) this).anInt11120 = 0;
	super.method1993(i);
    }
    
    Interface29 method8454(Class116 class116, int i, int i_175_, int i_176_,
			   boolean bool, byte[] is) {
	return new Class383_Sub1(this, class116, i, i_175_, i_176_, bool, is);
    }
    
    void method8271() {
	IDirect3DDevice.SetScissorRect(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt8984 + anInt8974,
				       anInt8995 + anInt8943, anInt8975,
				       anInt8928);
    }
    
    Interface34 method8456(Class116 class116, Class155 class155, int i,
			   int i_177_) {
	return new Class383_Sub3_Sub1(this, class116, class155, i, i_177_);
    }
    
    Interface34 method8457(Class116 class116, Class155 class155, int i,
			   int i_178_) {
	return new Class383_Sub3_Sub1(this, class116, class155, i, i_178_);
    }
    
    public void method8417() {
	if (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]) {
	    ((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010] = false;
	    IDirect3DDevice.SetTexture(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt9010, 0L);
	    method8330();
	    method8287();
	}
    }
    
    public void method8460() {
	if (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]) {
	    ((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010] = false;
	    IDirect3DDevice.SetTexture(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt9010, 0L);
	    method8330();
	    method8287();
	}
    }
    
    final void method8373(int i, Class338 class338, boolean bool,
			  boolean bool_179_) {
	if (aBool8921) {
	    int i_180_ = 0;
	    int i_181_;
	    switch (i) {
	    default:
		i_181_ = 2;
		break;
	    case 2:
		i_181_ = 26;
		break;
	    case 1:
		i_181_ = 3;
	    }
	    if (bool)
		i_180_ |= 0x20;
	    if (bool_179_)
		i_180_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, i_181_,
						 (method10191(class338)
						  | i_180_));
	}
    }
    
    public Interface16 method2019(int i, int i_182_) {
	return new Class378(this, Class155.aClass155_1890, i, i_182_, 0);
    }
    
    void method8239() {
	if (aBool8921) {
	    D3DLIGHT.SetAmbient(((Class151_Sub2_Sub1) this).aLong11102,
				aFloat8997 * aFloat9000,
				aFloat8998 * aFloat9000,
				aFloat8999 * aFloat9000, 0.0F);
	    ((Class151_Sub2_Sub1) this).aBool11105 = false;
	}
    }
    
    void method8259() {
	/* empty */
    }
    
    Interface29 method8455(Class116 class116, int i, int i_183_, int i_184_,
			   boolean bool, byte[] is) {
	return new Class383_Sub1(this, class116, i, i_183_, i_184_, bool, is);
    }
    
    void method8468() {
	if (aBool8921) {
	    int i = (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]
		     ? method10186(aClass345Array9014[anInt9010]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 1, i);
	}
    }
    
    void method8469() {
	if (aBool8921) {
	    int i = (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]
		     ? method10186(aClass345Array9014[anInt9010]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 1, i);
	}
    }
    
    public Class144_Sub2 method2017() {
	return new Class144_Sub2_Sub3_Sub1(this);
    }
    
    public boolean method8485() {
	return ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    Class144_Sub1 method2334(Canvas canvas, int i, int i_185_) {
	return new Class144_Sub1_Sub1_Sub1(this, canvas, i, i_185_, false);
    }
    
    void method8473() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 15,
				   aBool8972);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, aByte9056 & 0xff);
	if ((((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
	     .MultiSampleType)
	    > 0) {
	    if (!aBool8972 || aByte9056 == 0) {
		if (((Class151_Sub2_Sub1) this).aBool11098
		    || ((Class151_Sub2_Sub1) this).aBool11116)
		    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						    .aLong11097),
						   181, 0);
		else if (((Class151_Sub2_Sub1) this).aBool11121)
		    IDirect3DDevice.method9110((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154, 1.0F);
	    } else if (((Class151_Sub2_Sub1) this).aBool11098)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('S', 'S', 'A', 'A'));
	    else if (((Class151_Sub2_Sub1) this).aBool11116)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('A', 'T', 'O', 'C'));
	    else if (((Class151_Sub2_Sub1) this).aBool11121)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154,
					       method8355('A', '2', 'M', '1'));
	}
    }
    
    void method8357() {
	switch (aClass337_9053.anInt3619) {
	case 3:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 5);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 6);
	    break;
	case 0:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 9);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 2);
	    break;
	case 1:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 1);
	    break;
	case 2:
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 19, 2);
	    IDirect3DDevice
		.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097, 20, 2);
	    break;
	}
	switch (anInt8937) {
	case 2:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 2);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 2);
	    break;
	case 3:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 1);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 2);
	    break;
	case 0:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 1);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 1);
	    break;
	case 1:
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   207, 2);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   208, 1);
	    break;
	}
    }
    
    public void method2022(int i, int i_186_, int i_187_) {
	if (((Class151_Sub2_Sub1) this).aLong11112 == 0L)
	    method10181(i_186_, i_187_);
	long l
	    = IDirect3DDevice
		  .GetRenderTarget(((Class151_Sub2_Sub1) this).aLong11097, 0);
	if (!Class326.method4294(IDirect3DDevice.StretchRect
				 (((Class151_Sub2_Sub1) this).aLong11097, l, 0,
				  0, aClass144_1857.method1943(),
				  aClass144_1857.method1944(),
				  ((Class151_Sub2_Sub1) this).aLong11112,
				  anInt1829 * 1882172349,
				  anInt1859 * 503204773,
				  anInt1830 * -1250842191,
				  anInt1861 * -750000687, 2))) {
	    /* empty */
	}
	IUnknown.Release(l);
	IDirect3DDevice.GetRenderTargetData
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class151_Sub2_Sub1) this).aLong11112,
	     (((Class151_Sub2_Sub1) this).aLongArray11133
	      [((Class151_Sub2_Sub1) this).anInt11136]));
	long l_188_
	    = IDirect3DDevice
		  .CreateEventQuery(((Class151_Sub2_Sub1) this).aLong11097);
	if (Class326.method4295(IDirect3DEventQuery.Issue(l_188_)))
	    ((Class151_Sub2_Sub1) this).aLongArray11119
		[((Class151_Sub2_Sub1) this).anInt11136]
		= l_188_;
	((Class151_Sub2_Sub1) this).anIntArray11132
	    [((Class151_Sub2_Sub1) this).anInt11136]
	    = i;
	if (++((Class151_Sub2_Sub1) this).anInt11136 >= 3)
	    ((Class151_Sub2_Sub1) this).anInt11136 = 0;
    }
    
    void method8402() {
	IDirect3DDevice.SetScissorRect(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt8984 + anInt8974,
				       anInt8995 + anInt8943, anInt8975,
				       anInt8928);
    }
    
    void method8477() {
	aFloat9050 = aFloat8971 - (float) anInt9048;
	aFloat9049 = aFloat9050 - (float) anInt9047;
	if (aFloat9049 < aFloat8988)
	    aFloat9049 = aFloat8988;
	if (aBool8921) {
	    IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097,
				       36, aFloat9049);
	    IDirect3DDevice.method9110(((Class151_Sub2_Sub1) this).aLong11097,
				       37, aFloat9050);
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   34, anInt9046);
	}
    }
    
    void method8479(boolean bool) {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 161,
				   bool);
    }
    
    public void method8367(int i, Interface33 interface33) {
	Class376 class376 = (Class376) interface33;
	IDirect3DDevice.SetStreamSource(((Class151_Sub2_Sub1) this).aLong11097,
					i, ((Class376) class376).aLong4206, 0,
					class376.method4597());
    }
    
    Class325 method8364(Class311[] class311s) {
	return new Class325_Sub2(this, class311s);
    }
    
    public boolean method2163() {
	return true;
    }
    
    public void method2016(long l) {
	/* empty */
    }
    
    void method8472() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 15,
				   aBool8972);
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       24, aByte9056 & 0xff);
	if ((((Class151_Sub2_Sub1) this).aD3DPRESENT_PARAMETERS11122
	     .MultiSampleType)
	    > 0) {
	    if (!aBool8972 || aByte9056 == 0) {
		if (((Class151_Sub2_Sub1) this).aBool11098
		    || ((Class151_Sub2_Sub1) this).aBool11116)
		    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						    .aLong11097),
						   181, 0);
		else if (((Class151_Sub2_Sub1) this).aBool11121)
		    IDirect3DDevice.method9110((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154, 1.0F);
	    } else if (((Class151_Sub2_Sub1) this).aBool11098)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('S', 'S', 'A', 'A'));
	    else if (((Class151_Sub2_Sub1) this).aBool11116)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       181,
					       method8355('A', 'T', 'O', 'C'));
	    else if (((Class151_Sub2_Sub1) this).aBool11121)
		IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
						.aLong11097),
					       154,
					       method8355('A', '2', 'M', '1'));
	}
    }
    
    public void method8484(int i, Interface33 interface33) {
	Class376 class376 = (Class376) interface33;
	IDirect3DDevice.SetStreamSource(((Class151_Sub2_Sub1) this).aLong11097,
					i, ((Class376) class376).aLong4206, 0,
					class376.method4597());
    }
    
    public void method8317(int i, Interface33 interface33) {
	Class376 class376 = (Class376) interface33;
	IDirect3DDevice.SetStreamSource(((Class151_Sub2_Sub1) this).aLong11097,
					i, ((Class376) class376).aLong4206, 0,
					class376.method4597());
    }
    
    void method2330() {
	super.method2233();
	if (((Class151_Sub2_Sub1) this).aLong11102 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11102);
	    ((Class151_Sub2_Sub1) this).aLong11102 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11103 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11103);
	    ((Class151_Sub2_Sub1) this).aLong11103 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11131 != 0L) {
	    D3DLIGHT.Destroy(((Class151_Sub2_Sub1) this).aLong11131);
	    ((Class151_Sub2_Sub1) this).aLong11131 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11097 != 0L) {
	    IDirect3DDevice.Destroy(((Class151_Sub2_Sub1) this).aLong11097);
	    ((Class151_Sub2_Sub1) this).aLong11097 = 0L;
	}
	if (((Class151_Sub2_Sub1) this).aLong11126 != 0L) {
	    IUnknown.Release(((Class151_Sub2_Sub1) this).aLong11126);
	    ((Class151_Sub2_Sub1) this).aLong11126 = 0L;
	}
    }
    
    void method8381(Interface39 interface39) {
	IDirect3DDevice.SetIndices(((Class151_Sub2_Sub1) this).aLong11097,
				   (((Class385) (Class385) interface39)
				    .aLong4490));
    }
    
    public final void method8488(Class342 class342, int i, int i_189_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawPrimitive(((Class151_Sub2_Sub1) this).aLong11097,
				      method10195(class342), i, i_189_);
    }
    
    public final void method8489(Class342 class342, int i, int i_190_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawPrimitive(((Class151_Sub2_Sub1) this).aLong11097,
				      method10195(class342), i, i_190_);
    }
    
    public void method2171(long l) {
	/* empty */
    }
    
    final void method8291(Interface39 interface39, Class342 class342, int i,
			  int i_191_, int i_192_, int i_193_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitiveIB
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class385) (Class385) interface39).aLong4490, 4, 0, i, i_191_,
	     i_192_, i_193_);
    }
    
    final void method8492(Interface39 interface39, Class342 class342, int i,
			  int i_194_, int i_195_, int i_196_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitiveIB
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class385) (Class385) interface39).aLong4490, 4, 0, i, i_194_,
	     i_195_, i_196_);
    }
    
    final void method8493(Interface39 interface39, Class342 class342, int i,
			  int i_197_, int i_198_, int i_199_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitiveIB
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class385) (Class385) interface39).aLong4490, 4, 0, i, i_197_,
	     i_198_, i_199_);
    }
    
    void method8424(int i) {
	if (!((Class151_Sub2_Sub1) this).aBool11125) {
	    int i_200_ = (i & 0x2) != 0 ? 2 : 3;
	    IDirect3DDevice.SetRenderState((((Class151_Sub2_Sub1) this)
					    .aLong11097),
					   8, i_200_);
	}
    }
    
    boolean method8386(Class116 class116, Class155 class155) {
	D3DDISPLAYMODE d3ddisplaymode = new D3DDISPLAYMODE();
	return (Class326.method4295(IDirect3D.GetAdapterDisplayMode
				    (((Class151_Sub2_Sub1) this).aLong11126,
				     ((Class151_Sub2_Sub1) this).anInt11138,
				     d3ddisplaymode))
		&& Class326.method4295(IDirect3D.CheckDeviceFormat
				       (((Class151_Sub2_Sub1) this).aLong11126,
					((Class151_Sub2_Sub1) this).anInt11138,
					((Class151_Sub2_Sub1) this).anInt11095,
					d3ddisplaymode.Format, 0, 3,
					method10193(class116, class155))));
    }
    
    public Interface18 method2324(int i, int i_201_, Class116 class116,
				  Class155 class155, int i_202_) {
	return new Class390(this, class116, class155, i, i_201_, i_202_);
    }
    
    public boolean method8366() {
	return ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    public boolean method8497() {
	return ((((Class151_Sub2_Sub1) this).aD3DCAPS11115.VertexShaderVersion
		 & 0xffff)
		>= 257);
    }
    
    Class325 method8481(Class311[] class311s) {
	return new Class325_Sub2(this, class311s);
    }
    
    void method8344(Interface39 interface39) {
	IDirect3DDevice.SetIndices(((Class151_Sub2_Sub1) this).aLong11097,
				   (((Class385) (Class385) interface39)
				    .aLong4490));
    }
    
    public String method2148() {
	String string = "Caps: 4:";
	String string_203_ = ":";
	string = new StringBuilder().append(string).append(anInt9057).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append(anInt9063).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append(anInt8964).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9068 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (method8485() ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (method8378() ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9070 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9069 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11128 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11096 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11118 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11117 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9065 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9066 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9078 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11116 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11121 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11098 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (aBool9072 ? 1 : 0).append
		     (string_203_).toString();
	string = new StringBuilder().append(string).append
		     (((Class151_Sub2_Sub1) this).aBool11123 ? 1 : 0).append
		     (string_203_).toString();
	string
	    = new StringBuilder().append(string).append
		  (((Class151_Sub2_Sub1) this).aBool11124 ? 1 : 0).toString();
	return string;
    }
    
    void method8330() {
	if (aBool8921) {
	    int i = (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]
		     ? method10186(aClass345Array8917[anInt9010]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 4, i);
	}
    }
    
    Interface29 method8310(Class116 class116, int i, int i_204_, int i_205_,
			   boolean bool, byte[] is) {
	return new Class383_Sub1(this, class116, i, i_204_, i_205_, bool, is);
    }
    
    public Class127 method2119() {
	D3DADAPTER_IDENTIFIER d3dadapter_identifier
	    = new D3DADAPTER_IDENTIFIER();
	IDirect3D.GetAdapterIdentifier(((Class151_Sub2_Sub1) this).aLong11126,
				       ((Class151_Sub2_Sub1) this).anInt11138,
				       0, d3dadapter_identifier);
	return new Class127(d3dadapter_identifier.VendorID,
			    method8241() ? "Direct3D FF" : "Direct3D", 9,
			    d3dadapter_identifier.Description,
			    d3dadapter_identifier.DriverVersion, method8241());
    }
    
    void method10199(Interface49 interface49) {
	if (method10190(interface49) == null)
	    ((Class151_Sub2_Sub1) this).aClass656_11100
		.method7791(new Class487_Sub24(interface49), (byte) 3);
    }
    
    Class144_Sub1 method2333(Canvas canvas, int i, int i_206_) {
	return new Class144_Sub1_Sub1_Sub1(this, canvas, i, i_206_, false);
    }
    
    final void method8465(int i, Class338 class338, boolean bool) {
	if (aBool8921) {
	    int i_207_ = 0;
	    int i_208_;
	    switch (i) {
	    default:
		i_208_ = 5;
		break;
	    case 1:
		i_208_ = 6;
		break;
	    case 2:
		i_208_ = 27;
	    }
	    if (bool)
		i_207_ |= 0x10;
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, i_208_,
						 (method10191(class338)
						  | i_207_));
	}
    }
    
    final void method8350(Interface39 interface39, Class342 class342, int i,
			  int i_209_, int i_210_, int i_211_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitiveIB
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class385) (Class385) interface39).aLong4490, 4, 0, i, i_209_,
	     i_210_, i_211_);
    }
    
    void method8287() {
	if (aBool8921) {
	    int i = (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]
		     ? method10186(aClass345Array9014[anInt9010]) : 1);
	    IDirect3DDevice.SetTextureStageState((((Class151_Sub2_Sub1) this)
						  .aLong11097),
						 anInt9010, 1, i);
	}
    }
    
    public Class144_Sub2 method2321() {
	return new Class144_Sub2_Sub3_Sub1(this);
    }
    
    public void method8238(Class403 class403) {
	class403.method4863(((Class151_Sub2_Sub1) this).aClass403_11127);
    }
    
    void method8420() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 7,
				   aBool8924);
    }
    
    void method8326() {
	if (aClass144_1857 != null)
	    IDirect3DDevice.SetViewport(((Class151_Sub2_Sub1) this).aLong11097,
					anInt8984 + anInt8981,
					anInt8995 + anInt9002, anInt9062,
					anInt8983, aFloat8966, aFloat9004);
    }
    
    public void method8315() {
	if (((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010]) {
	    ((Class151_Sub2_Sub1) this).aBoolArray11108[anInt9010] = false;
	    IDirect3DDevice.SetTexture(((Class151_Sub2_Sub1) this).aLong11097,
				       anInt9010, 0L);
	    method8330();
	    method8287();
	}
    }
    
    void method8308() {
	IDirect3DDevice.method9111(((Class151_Sub2_Sub1) this).aLong11097, 174,
				   aBool9087);
    }
    
    public long method2175(int i, int i_212_) {
	return method10182(i, i_212_, null, null);
    }
    
    void method8499(int i) {
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       168, i);
    }
    
    void method8500(int i) {
	IDirect3DDevice.SetRenderState(((Class151_Sub2_Sub1) this).aLong11097,
				       168, i);
    }
    
    Class144_Sub1 method2331(Canvas canvas, int i, int i_213_) {
	return new Class144_Sub1_Sub1_Sub1(this, canvas, i, i_213_, false);
    }
    
    final Interface39 method8501(boolean bool) {
	return new Class385(this, Class155.aClass155_1885, bool);
    }
    
    final Interface39 method8502(boolean bool) {
	return new Class385(this, Class155.aClass155_1885, bool);
    }
    
    public final void method8503(Class342 class342, int i, int i_214_,
				 int i_215_, int i_216_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitive((((Class151_Sub2_Sub1) this)
					      .aLong11097),
					     method10195(class342), 0, i,
					     i_214_, i_215_, i_216_);
    }
    
    public void method2287() {
	for (int i = 0; i < 3; i++) {
	    if (((Class151_Sub2_Sub1) this).aLongArray11119[i] != 0L) {
		IUnknown
		    .Release(((Class151_Sub2_Sub1) this).aLongArray11119[i]);
		((Class151_Sub2_Sub1) this).aLongArray11119[i] = 0L;
	    }
	}
	((Class151_Sub2_Sub1) this).anInt11136 = 0;
	((Class151_Sub2_Sub1) this).anInt11135 = 0;
    }
    
    public void method8498(Class403 class403) {
	class403.method4863(((Class151_Sub2_Sub1) this).aClass403_11127);
    }
    
    final void method8490(Interface39 interface39, Class342 class342, int i,
			  int i_217_, int i_218_, int i_219_) {
	if (((Class151_Sub2_Sub1) this).aClass230_Sub2_11099 != null)
	    ((Class151_Sub2_Sub1) this).aClass230_Sub2_11099.method8797();
	IDirect3DDevice.DrawIndexedPrimitiveIB
	    (((Class151_Sub2_Sub1) this).aLong11097,
	     ((Class385) (Class385) interface39).aLong4490, 4, 0, i, i_217_,
	     i_218_, i_219_);
    }
}
