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

import jagdx.IDirect3DDevice;
import jagdx.IUnknown;

public class Class325_Sub2 extends Class325
{
    Class151_Sub2_Sub1 aClass151_Sub2_Sub1_9833;
    long aLong9834 = 0L;
    
    void method8866() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833
		.method10197(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
    }
    
    void method8867(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 method81() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    IUnknown.Release(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
	((Class325_Sub2) this).aClass151_Sub2_Sub1_9833.method8237(this);
    }
    
    void method8868() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833
		.method10197(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
    }
    
    public void finalize() {
	method8868();
    }
    
    void method8869() {
	method8868();
    }
    
    public void method79() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    IUnknown.Release(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
	((Class325_Sub2) this).aClass151_Sub2_Sub1_9833.method8237(this);
    }
    
    void method8870() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833
		.method10197(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
    }
    
    public void method80() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    IUnknown.Release(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
	((Class325_Sub2) this).aClass151_Sub2_Sub1_9833.method8237(this);
    }
    
    Class325_Sub2(Class151_Sub2_Sub1 class151_sub2_sub1,
		  Class311[] class311s) {
	super(class311s);
	((Class325_Sub2) this).aClass151_Sub2_Sub1_9833 = class151_sub2_sub1;
	byte i = 0;
	ByteBuffer bytebuffer
	    = ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833.aByteBuffer9026;
	bytebuffer.clear();
	for (short i_5_ = 0; i_5_ < aClass311Array3567.length; i_5_++) {
	    short i_6_ = 0;
	    Class311 class311 = aClass311Array3567[i_5_];
	    for (int i_7_ = 0; i_7_ < class311.method4109(); i_7_++) {
		Class324 class324 = class311.method4113(i_7_);
		if (class324 == Class324.aClass324_3561)
		    method8867(bytebuffer, i_5_, i_6_, (byte) 2, (byte) 0,
			       (byte) 0, (byte) 0);
		else if (class324 == Class324.aClass324_3558)
		    method8867(bytebuffer, i_5_, i_6_, (byte) 2, (byte) 0,
			       (byte) 3, (byte) 0);
		else if (class324 == Class324.aClass324_3562)
		    method8867(bytebuffer, i_5_, i_6_, (byte) 4, (byte) 0,
			       (byte) 10, (byte) 0);
		else if (class324 == Class324.aClass324_3548) {
		    Class325_Sub2 class325_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++;
		    class325_sub2_8_.method8867(bytebuffer_9_, i_10_, i_11_,
						i_12_, i_13_, i_14_, i_15_);
		} else if (class324 == Class324.aClass324_3552) {
		    Class325_Sub2 class325_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++;
		    class325_sub2_16_.method8867(bytebuffer_17_, i_18_, i_19_,
						 i_20_, i_21_, i_22_, i_23_);
		} else if (class324 == Class324.aClass324_3553) {
		    Class325_Sub2 class325_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++;
		    class325_sub2_24_.method8867(bytebuffer_25_, i_26_, i_27_,
						 i_28_, i_29_, i_30_, i_31_);
		} else if (class324 == Class324.aClass324_3554) {
		    Class325_Sub2 class325_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++;
		    class325_sub2_32_.method8867(bytebuffer_33_, i_34_, i_35_,
						 i_36_, i_37_, i_38_, i_39_);
		}
		i_6_ += class324.anInt3564;
	    }
	}
	method8867(bytebuffer, (short) 255, (short) 0, (byte) 17, (byte) 0,
		   (byte) 0, (byte) 0);
	((Class325_Sub2) this).aLong9834
	    = (IDirect3DDevice.CreateVertexDeclaration
	       (((Class151_Sub2_Sub1)
		 ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833).aLong11097,
		((Class325_Sub2) this).aClass151_Sub2_Sub1_9833.aLong8955));
	((Class325_Sub2) this).aClass151_Sub2_Sub1_9833.method8379(this);
    }
    
    void method8871() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833
		.method10197(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
    }
    
    void method8872() {
	if (((Class325_Sub2) this).aLong9834 != 0L) {
	    ((Class325_Sub2) this).aClass151_Sub2_Sub1_9833
		.method10197(((Class325_Sub2) this).aLong9834);
	    ((Class325_Sub2) this).aLong9834 = 0L;
	}
    }
    
    void method8873() {
	method8868();
    }
}
