/* Class363_Sub2 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import java.nio.ByteBuffer;

import jagdx.IDirect3DDevice;
import jagdx.IUnknown;

public class Class363_Sub2 extends Class363 {
	long aLong9970 = 0L;
	Class84_Sub1_Sub2 aClass84_Sub1_Sub2_9971;

	public void method23() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			IUnknown.Release(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
		((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method14751(this);
	}

	void method16183(ByteBuffer bytebuffer, short i, short i_0_, byte i_1_, byte i_2_, byte i_3_, byte i_4_) {
		bytebuffer.putShort(i);
		bytebuffer.putShort(i_0_);
		bytebuffer.put(i_1_);
		bytebuffer.put(i_2_);
		bytebuffer.put(i_3_);
		bytebuffer.put(i_4_);
	}

	public void method54() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			IUnknown.Release(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
		((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method14751(this);
	}

	public void finalize() {
		method16189();
	}

	void method16184() {
		method16189();
	}

	void method16185() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method16648(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
	}

	void method16186(ByteBuffer bytebuffer, short i, short i_5_, byte i_6_, byte i_7_, byte i_8_, byte i_9_) {
		bytebuffer.putShort(i);
		bytebuffer.putShort(i_5_);
		bytebuffer.put(i_6_);
		bytebuffer.put(i_7_);
		bytebuffer.put(i_8_);
		bytebuffer.put(i_9_);
	}

	public void method53() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			IUnknown.Release(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
		((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method14751(this);
	}

	Class363_Sub2(Class84_Sub1_Sub2 class84_sub1_sub2, Class384[] class384s) {
		super(class384s);
		((Class363_Sub2) this).aClass84_Sub1_Sub2_9971 = class84_sub1_sub2;
		byte i = 0;
		ByteBuffer bytebuffer = ((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.aByteBuffer8876;
		bytebuffer.clear();
		for (short i_10_ = 0; i_10_ < aClass384Array5525.length; i_10_++) {
			short i_11_ = 0;
			Class384 class384 = aClass384Array5525[i_10_];
			for (int i_12_ = 0; i_12_ < class384.method7073(); i_12_++) {
				Class371 class371 = class384.method7074(i_12_);
				if (class371 == Class371.aClass371_5581)
					method16183(bytebuffer, i_10_, i_11_, (byte) 2, (byte) 0, (byte) 0, (byte) 0);
				else if (class371 == Class371.aClass371_5569)
					method16183(bytebuffer, i_10_, i_11_, (byte) 2, (byte) 0, (byte) 3, (byte) 0);
				else if (class371 == Class371.aClass371_5570)
					method16183(bytebuffer, i_10_, i_11_, (byte) 4, (byte) 0, (byte) 10, (byte) 0);
				else if (class371 == Class371.aClass371_5584) {
					Class363_Sub2 class363_sub2_13_ = this;
					ByteBuffer bytebuffer_14_ = bytebuffer;
					short i_15_ = i_10_;
					short i_16_ = i_11_;
					byte i_17_ = 0;
					byte i_18_ = 0;
					byte i_19_ = 5;
					byte i_20_ = i;
					i++;
					class363_sub2_13_.method16183(bytebuffer_14_, i_15_, i_16_, i_17_, i_18_, i_19_, i_20_);
				} else if (class371 == Class371.aClass371_5568) {
					Class363_Sub2 class363_sub2_21_ = this;
					ByteBuffer bytebuffer_22_ = bytebuffer;
					short i_23_ = i_10_;
					short i_24_ = i_11_;
					byte i_25_ = 1;
					byte i_26_ = 0;
					byte i_27_ = 5;
					byte i_28_ = i;
					i++;
					class363_sub2_21_.method16183(bytebuffer_22_, i_23_, i_24_, i_25_, i_26_, i_27_, i_28_);
				} else if (class371 == Class371.aClass371_5573) {
					Class363_Sub2 class363_sub2_29_ = this;
					ByteBuffer bytebuffer_30_ = bytebuffer;
					short i_31_ = i_10_;
					short i_32_ = i_11_;
					byte i_33_ = 2;
					byte i_34_ = 0;
					byte i_35_ = 5;
					byte i_36_ = i;
					i++;
					class363_sub2_29_.method16183(bytebuffer_30_, i_31_, i_32_, i_33_, i_34_, i_35_, i_36_);
				} else if (class371 == Class371.aClass371_5572) {
					Class363_Sub2 class363_sub2_37_ = this;
					ByteBuffer bytebuffer_38_ = bytebuffer;
					short i_39_ = i_10_;
					short i_40_ = i_11_;
					byte i_41_ = 3;
					byte i_42_ = 0;
					byte i_43_ = 5;
					byte i_44_ = i;
					i++;
					class363_sub2_37_.method16183(bytebuffer_38_, i_39_, i_40_, i_41_, i_42_, i_43_, i_44_);
				}
				i_11_ += class371.anInt5579;
			}
		}
		method16183(bytebuffer, (short) 255, (short) 0, (byte) 17, (byte) 0, (byte) 0, (byte) 0);
		((Class363_Sub2) this).aLong9970 = (IDirect3DDevice.CreateVertexDeclaration(((Class84_Sub1_Sub2) ((Class363_Sub2) this).aClass84_Sub1_Sub2_9971).aLong10431, ((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.aLong8893));
		((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method14925(this);
	}

	void method16187() {
		method16189();
	}

	public void method19() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			IUnknown.Release(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
		((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method14751(this);
	}

	void method16188() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method16648(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
	}

	void method16189() {
		if (((Class363_Sub2) this).aLong9970 != 0L) {
			((Class363_Sub2) this).aClass84_Sub1_Sub2_9971.method16648(((Class363_Sub2) this).aLong9970);
			((Class363_Sub2) this).aLong9970 = 0L;
		}
	}
}
