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

import jagdx.IDirect3DDevice;
import jagdx.IUnknown;

public class Class367_Sub2 extends Class367
{
    long aLong10228 = 0L;
    Class87_Sub2_Sub1 aClass87_Sub2_Sub1_10229;
    
    void method16673() {
	if (((Class367_Sub2) this).aLong10228 != 0L) {
	    ((Class367_Sub2) this).aClass87_Sub2_Sub1_10229
		.method17404(((Class367_Sub2) this).aLong10228);
	    ((Class367_Sub2) this).aLong10228 = 0L;
	}
    }
    
    void method16674(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 method23() {
	if (((Class367_Sub2) this).aLong10228 != 0L) {
	    IUnknown.Release(((Class367_Sub2) this).aLong10228);
	    ((Class367_Sub2) this).aLong10228 = 0L;
	}
	((Class367_Sub2) this).aClass87_Sub2_Sub1_10229.method15467(this);
    }
    
    public void finalize() {
	method16673();
    }
    
    Class367_Sub2(Class87_Sub2_Sub1 class87_sub2_sub1, Class378[] class378s) {
	super(class378s);
	((Class367_Sub2) this).aClass87_Sub2_Sub1_10229 = class87_sub2_sub1;
	byte i = 0;
	ByteBuffer bytebuffer
	    = ((Class367_Sub2) this).aClass87_Sub2_Sub1_10229.aByteBuffer9139;
	bytebuffer.clear();
	for (short i_5_ = 0; i_5_ < aClass378Array5533.length; i_5_++) {
	    short i_6_ = 0;
	    Class378 class378 = aClass378Array5533[i_5_];
	    for (int i_7_ = 0; i_7_ < class378.method7008(); i_7_++) {
		Class379 class379 = class378.method7013(i_7_);
		if (class379 == Class379.aClass379_5607)
		    method16674(bytebuffer, i_5_, i_6_, (byte) 2, (byte) 0,
				(byte) 0, (byte) 0);
		else if (class379 == Class379.aClass379_5595)
		    method16674(bytebuffer, i_5_, i_6_, (byte) 2, (byte) 0,
				(byte) 3, (byte) 0);
		else if (class379 == Class379.aClass379_5604)
		    method16674(bytebuffer, i_5_, i_6_, (byte) 4, (byte) 0,
				(byte) 10, (byte) 0);
		else if (class379 == Class379.aClass379_5603) {
		    Class367_Sub2 class367_sub2_8_ = this;
		    ByteBuffer bytebuffer_9_ = bytebuffer;
		    short i_10_ = i_5_;
		    short i_11_ = i_6_;
		    byte i_12_ = 0;
		    byte i_13_ = 0;
		    byte i_14_ = 5;
		    byte i_15_ = i;
		    i++;
		    class367_sub2_8_.method16674(bytebuffer_9_, i_10_, i_11_,
						 i_12_, i_13_, i_14_, i_15_);
		} else if (class379 == Class379.aClass379_5598) {
		    Class367_Sub2 class367_sub2_16_ = this;
		    ByteBuffer bytebuffer_17_ = bytebuffer;
		    short i_18_ = i_5_;
		    short i_19_ = i_6_;
		    byte i_20_ = 1;
		    byte i_21_ = 0;
		    byte i_22_ = 5;
		    byte i_23_ = i;
		    i++;
		    class367_sub2_16_.method16674(bytebuffer_17_, i_18_, i_19_,
						  i_20_, i_21_, i_22_, i_23_);
		} else if (class379 == Class379.aClass379_5599) {
		    Class367_Sub2 class367_sub2_24_ = this;
		    ByteBuffer bytebuffer_25_ = bytebuffer;
		    short i_26_ = i_5_;
		    short i_27_ = i_6_;
		    byte i_28_ = 2;
		    byte i_29_ = 0;
		    byte i_30_ = 5;
		    byte i_31_ = i;
		    i++;
		    class367_sub2_24_.method16674(bytebuffer_25_, i_26_, i_27_,
						  i_28_, i_29_, i_30_, i_31_);
		} else if (class379 == Class379.aClass379_5600) {
		    Class367_Sub2 class367_sub2_32_ = this;
		    ByteBuffer bytebuffer_33_ = bytebuffer;
		    short i_34_ = i_5_;
		    short i_35_ = i_6_;
		    byte i_36_ = 3;
		    byte i_37_ = 0;
		    byte i_38_ = 5;
		    byte i_39_ = i;
		    i++;
		    class367_sub2_32_.method16674(bytebuffer_33_, i_34_, i_35_,
						  i_36_, i_37_, i_38_, i_39_);
		}
		i_6_ += class379.anInt5606;
	    }
	}
	method16674(bytebuffer, (short) 255, (short) 0, (byte) 17, (byte) 0,
		    (byte) 0, (byte) 0);
	((Class367_Sub2) this).aLong10228
	    = (IDirect3DDevice.CreateVertexDeclaration
	       (((Class87_Sub2_Sub1)
		 ((Class367_Sub2) this).aClass87_Sub2_Sub1_10229).aLong10888,
		((Class367_Sub2) this).aClass87_Sub2_Sub1_10229.aLong9140));
	((Class367_Sub2) this).aClass87_Sub2_Sub1_10229.method15395(this);
    }
    
    public void method24() {
	if (((Class367_Sub2) this).aLong10228 != 0L) {
	    IUnknown.Release(((Class367_Sub2) this).aLong10228);
	    ((Class367_Sub2) this).aLong10228 = 0L;
	}
	((Class367_Sub2) this).aClass87_Sub2_Sub1_10229.method15467(this);
    }
    
    void method16675() {
	method16673();
    }
    
    void method16676(ByteBuffer bytebuffer, short i, short i_40_, byte i_41_,
		     byte i_42_, byte i_43_, byte i_44_) {
	bytebuffer.putShort(i);
	bytebuffer.putShort(i_40_);
	bytebuffer.put(i_41_);
	bytebuffer.put(i_42_);
	bytebuffer.put(i_43_);
	bytebuffer.put(i_44_);
    }
    
    void method16677(ByteBuffer bytebuffer, short i, short i_45_, byte i_46_,
		     byte i_47_, byte i_48_, byte i_49_) {
	bytebuffer.putShort(i);
	bytebuffer.putShort(i_45_);
	bytebuffer.put(i_46_);
	bytebuffer.put(i_47_);
	bytebuffer.put(i_48_);
	bytebuffer.put(i_49_);
    }
    
    void method16678() {
	if (((Class367_Sub2) this).aLong10228 != 0L) {
	    ((Class367_Sub2) this).aClass87_Sub2_Sub1_10229
		.method17404(((Class367_Sub2) this).aLong10228);
	    ((Class367_Sub2) this).aLong10228 = 0L;
	}
    }
    
    void method16679() {
	if (((Class367_Sub2) this).aLong10228 != 0L) {
	    ((Class367_Sub2) this).aClass87_Sub2_Sub1_10229
		.method17404(((Class367_Sub2) this).aLong10228);
	    ((Class367_Sub2) this).aLong10228 = 0L;
	}
    }
}
