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

public class Class322
{
    Class479_Sub3_Sub1[][] aClass479_Sub3_Sub1ArrayArray3523;
    Interface33 anInterface33_3524;
    Class325 aClass325_3525;
    Class479_Sub3_Sub1[][] aClass479_Sub3_Sub1ArrayArray3526;
    int anInt3527 = 64;
    int anInt3528 = 768;
    int anInt3529 = 1600;
    int anInt3530 = Class273.method3753(1600, (short) -4541);
    int anInt3531 = 64;
    Interface39 anInterface39_3532;
    int[] anIntArray3533;
    int[] anIntArray3534;
    int[] anIntArray3535 = new int[8191];
    Interface33 anInterface33_3536;
    int anInt3537;
    static float aFloat3538;
    
    void method4286(Class151_Sub2 class151_sub2) {
	((Class322) this).anInterface33_3536.method216(786336, 24);
    }
    
    void method4287(int i, Class479_Sub3_Sub1 class479_sub3_sub1) {
	if (i < 1600) {
	    if (((Class322) this).anIntArray3533[i] < 64)
		((Class322) this).aClass479_Sub3_Sub1ArrayArray3526[i]
		    [((Class322) this).anIntArray3533[i]++]
		    = class479_sub3_sub1;
	    else {
		if (((Class322) this).anIntArray3533[i] == 64) {
		    if (((Class322) this).anInt3537 == 64)
			return;
		    ((Class322) this).anIntArray3533[i]
			+= 1 + ((Class322) this).anInt3537++;
		}
		((Class322) this).aClass479_Sub3_Sub1ArrayArray3523
		    [((Class322) this).anIntArray3533[i] - 64 - 1]
		    [((Class322) this).anIntArray3534
			 [((Class322) this).anIntArray3533[i] - 64 - 1]++]
		    = class479_sub3_sub1;
	    }
	}
    }
    
    void method4288(Class151_Sub2 class151_sub2, Class147 class147) {
	class151_sub2.method2297(false);
	aFloat3538 = class151_sub2.aFloat9000;
	float f = class151_sub2.aClass403_8938.aFloatArray4592[2];
	float f_0_ = class151_sub2.aClass403_8938.aFloatArray4592[6];
	float f_1_ = class151_sub2.aClass403_8938.aFloatArray4592[10];
	float f_2_ = class151_sub2.aClass403_8938.aFloatArray4592[14];
	int i = 0;
	int i_3_ = 2147483647;
	int i_4_ = 0;
	Class479_Sub3 class479_sub3
	    = class147.aClass642_1729.aClass479_Sub3_8223;
	for (Class479_Sub3 class479_sub3_5_
		 = class479_sub3.aClass479_Sub3_10073;
	     class479_sub3_5_ != class479_sub3;
	     class479_sub3_5_ = class479_sub3_5_.aClass479_Sub3_10073) {
	    Class479_Sub3_Sub1 class479_sub3_sub1
		= (Class479_Sub3_Sub1) class479_sub3_5_;
	    int i_6_
		= (int) (f * (float) (class479_sub3_sub1.anInt11262 >> 12)
			 + f_0_ * (float) (class479_sub3_sub1.anInt11263 >> 12)
			 + f_1_ * (float) (class479_sub3_sub1.anInt11264 >> 12)
			 + f_2_);
	    if (i_6_ > i_4_)
		i_4_ = i_6_;
	    if (i_6_ < i_3_)
		i_3_ = i_6_;
	    ((Class322) this).anIntArray3535[i++] = i_6_;
	}
	int i_7_ = i_4_ - i_3_;
	int i_8_;
	if (i_7_ + 2 > 1600) {
	    i_8_ = (1 + Class273.method3753(i_7_, (short) 3707)
		    - ((Class322) this).anInt3530);
	    i_7_ = (i_7_ >> i_8_) + 2;
	} else {
	    i_8_ = 0;
	    i_7_ += 2;
	}
	class151_sub2.method8344(((Class322) this).anInterface39_3532);
	Class285 class285 = ((Class151_Sub2) class151_sub2).aClass285_9029;
	class285.method3866(Class403.aClass403_4593);
	class285.aClass403_3279.method4860();
	class285.anInt3280 = -1;
	boolean bool = class151_sub2.anInt9047 > 0;
	if (bool) {
	    class285.aClass388_3283.method4684(0.0F, 0.0F, 1.0F,
					       -class151_sub2.aFloat9049);
	    class285.aClass396_3281.method4761
		((float) (class151_sub2.anInt9046 >> 16 & 0xff) / 255.0F,
		 (float) (class151_sub2.anInt9046 >> 8 & 0xff) / 255.0F,
		 (float) (class151_sub2.anInt9046 >> 0 & 0xff) / 255.0F);
	    class285.aClass388_3283
		.method4689(((Class151_Sub2) class151_sub2).aClass403_8940);
	    class285.aClass388_3283.method4688(1.0F
					       / (class151_sub2.aFloat9050
						  - class151_sub2.aFloat9049));
	} else {
	    class285.aClass388_3283.method4684(0.0F, 0.0F, 0.0F, 0.0F);
	    class285.aClass396_3281.method4761(0.0F, 0.0F, 0.0F);
	}
	method4289(class151_sub2, class479_sub3, i_7_, i_3_, i_8_, class285,
		   bool);
	if (class151_sub2.aFloat9000 != aFloat3538)
	    class151_sub2.method2089(aFloat3538);
	class151_sub2.method2297(true);
    }
    
    void method4289(Class151_Sub2 class151_sub2, Class479_Sub3 class479_sub3,
		    int i, int i_9_, int i_10_, Class285 class285,
		    boolean bool) {
	Class479_Sub3 class479_sub3_11_ = class479_sub3.aClass479_Sub3_10073;
	int i_12_ = 0;
	int i_13_ = -2;
	boolean bool_14_ = true;
	boolean bool_15_ = true;
	while (class479_sub3_11_ != class479_sub3) {
	    ((Class322) this).anInt3537 = 0;
	    for (int i_16_ = 0; i_16_ < i; i_16_++)
		((Class322) this).anIntArray3533[i_16_] = 0;
	    for (int i_17_ = 0; i_17_ < 64; i_17_++)
		((Class322) this).anIntArray3534[i_17_] = 0;
	    for (/**/; class479_sub3_11_ != class479_sub3;
		 class479_sub3_11_ = class479_sub3_11_.aClass479_Sub3_10073) {
		Class479_Sub3_Sub1 class479_sub3_sub1
		    = (Class479_Sub3_Sub1) class479_sub3_11_;
		if (bool_15_) {
		    i_13_ = class479_sub3_sub1.anInt11266;
		    bool_14_ = class479_sub3_sub1.aBool11268;
		    bool_15_ = false;
		}
		if (i_12_ > 0
		    && (i_13_ != class479_sub3_sub1.anInt11266
			|| bool_14_ != class479_sub3_sub1.aBool11268)) {
		    bool_15_ = true;
		    break;
		}
		method4287((((Class322) this).anIntArray3535[i_12_++] - i_9_
			    >> i_10_),
			   class479_sub3_sub1);
	    }
	    class285.anInterface31_3277 = null;
	    if (i_13_ >= 0) {
		Class145 class145
		    = class151_sub2.aClass140_1833.method1927(i_13_,
							      2102901669);
		if (class145.aBool1690)
		    class285.anInterface31_3277
			= ((Class151_Sub2) class151_sub2).aClass307_9017
			      .method4087(class145);
		byte i_18_ = 0;
		if (class145.aClass544_1696 == Class544.aClass544_7359)
		    i_18_ = class145.aByte1676;
		class151_sub2.method8278(i_18_);
	    }
	    if (bool_14_ && class151_sub2.aFloat9000 != aFloat3538)
		class151_sub2.method2089(aFloat3538);
	    else if (class151_sub2.aFloat9000 != 1.0F)
		class151_sub2.method2089(1.0F);
	    method4292(class151_sub2, i, bool);
	}
    }
    
    void method4290() {
	((Class322) this).anInterface33_3536.method80();
    }
    
    Class322(Class151_Sub2 class151_sub2) {
	((Class322) this).anIntArray3533 = new int[1600];
	((Class322) this).anIntArray3534 = new int[64];
	((Class322) this).aClass479_Sub3_Sub1ArrayArray3526
	    = new Class479_Sub3_Sub1[1600][64];
	((Class322) this).aClass479_Sub3_Sub1ArrayArray3523
	    = new Class479_Sub3_Sub1[64][768];
	((Class322) this).anInt3537 = 0;
	((Class322) this).aClass325_3525
	    = (class151_sub2.method8342
	       (new Class311[]
		{ new Class311(new Class324[] { Class324.aClass324_3561,
						Class324.aClass324_3562,
						Class324.aClass324_3552 }),
		  new Class311(Class324.aClass324_3558) }));
	((Class322) this).anInterface33_3536 = class151_sub2.method8289(true);
	((Class322) this).anInterface33_3524 = class151_sub2.method8289(false);
	((Class322) this).anInterface33_3524.method216(393168, 12);
	((Class322) this).anInterface39_3532 = class151_sub2.method8341(false);
	((Class322) this).anInterface39_3532.method276(49146);
	ByteBuffer bytebuffer = class151_sub2.aByteBuffer9026;
	bytebuffer.clear();
	for (int i = 0; i < 8191; i++) {
	    int i_19_ = i * 4;
	    bytebuffer.putShort((short) i_19_);
	    bytebuffer.putShort((short) (i_19_ + 1));
	    bytebuffer.putShort((short) (i_19_ + 2));
	    bytebuffer.putShort((short) (i_19_ + 2));
	    bytebuffer.putShort((short) (i_19_ + 3));
	    bytebuffer.putShort((short) i_19_);
	}
	((Class322) this).anInterface39_3532
	    .method209(0, bytebuffer.position(), class151_sub2.aLong8955);
	bytebuffer.clear();
	for (int i = 0; i < 8191; i++) {
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(-1.0F);
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(-1.0F);
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(-1.0F);
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(0.0F);
	    bytebuffer.putFloat(-1.0F);
	    bytebuffer.putFloat(0.0F);
	}
	((Class322) this).anInterface33_3524
	    .method209(0, bytebuffer.position(), class151_sub2.aLong8955);
    }
    
    void method4291() {
	((Class322) this).anInterface33_3536.method80();
    }
    
    void method4292(Class151_Sub2 class151_sub2, int i, boolean bool) {
	int i_20_ = 0;
	Class403 class403 = class151_sub2.aClass403_8938;
	float f = class403.aFloatArray4592[0];
	float f_21_ = class403.aFloatArray4592[4];
	float f_22_ = class403.aFloatArray4592[8];
	float f_23_ = class403.aFloatArray4592[1];
	float f_24_ = class403.aFloatArray4592[5];
	float f_25_ = class403.aFloatArray4592[9];
	float f_26_ = f + f_23_;
	float f_27_ = f_21_ + f_24_;
	float f_28_ = f_22_ + f_25_;
	float f_29_ = f - f_23_;
	float f_30_ = f_21_ - f_24_;
	float f_31_ = f_22_ - f_25_;
	float f_32_ = f_23_ - f;
	float f_33_ = f_24_ - f_21_;
	float f_34_ = f_25_ - f_22_;
	float[] fs = new float[3];
	float[] fs_35_ = new float[3];
	class151_sub2.aClass403_9081
	    .method4862(((Class151_Sub2) class151_sub2).aClass403_8939);
	ByteBuffer bytebuffer = class151_sub2.aByteBuffer9026;
	bytebuffer.clear();
	for (int i_36_ = i - 1; i_36_ >= 0; i_36_--) {
	    int i_37_ = (((Class322) this).anIntArray3533[i_36_] > 64 ? 64
			 : ((Class322) this).anIntArray3533[i_36_]);
	    if (i_37_ > 0) {
		for (int i_38_ = i_37_ - 1; i_38_ >= 0; i_38_--) {
		    Class479_Sub3_Sub1 class479_sub3_sub1
			= (((Class322) this).aClass479_Sub3_Sub1ArrayArray3526
			   [i_36_][i_38_]);
		    int i_39_ = class479_sub3_sub1.anInt11267;
		    byte i_40_ = (byte) (i_39_ >> 16);
		    byte i_41_ = (byte) (i_39_ >> 8);
		    byte i_42_ = (byte) i_39_;
		    byte i_43_ = (byte) (i_39_ >>> 24);
		    if (((Class151_Sub2) class151_sub2).anInt8985 == 0) {
			byte i_44_ = i_40_;
			i_40_ = i_42_;
			i_42_ = i_44_;
		    }
		    float f_45_
			= (float) (class479_sub3_sub1.anInt11262 >> 12);
		    float f_46_
			= (float) (class479_sub3_sub1.anInt11263 >> 12);
		    float f_47_
			= (float) (class479_sub3_sub1.anInt11264 >> 12);
		    int i_48_ = class479_sub3_sub1.anInt11265 >> 12;
		    if (class479_sub3_sub1.aShort11259 != 0) {
			((Class151_Sub2) class151_sub2).aClass403_8946
			    .method4889
			    (class479_sub3_sub1.aShort11259, i_48_, i_48_,
			     0.0F, 0.0F, 0.0F);
			((Class151_Sub2) class151_sub2).aClass403_8946
			    .method4863(class151_sub2.aClass403_9081);
			((Class151_Sub2) class151_sub2).aClass403_8946
			    .method4868(1.0F, 0.0F, 0.0F, fs);
			((Class151_Sub2) class151_sub2).aClass403_8946
			    .method4868(0.0F, 1.0F, 0.0F, fs_35_);
			bytebuffer.putFloat(f_45_ - fs[0] - fs_35_[0]);
			bytebuffer.putFloat(f_46_ - fs[1] - fs_35_[1]);
			bytebuffer.putFloat(f_47_ - fs[2] - fs_35_[2]);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(0.0F);
			bytebuffer.putFloat(0.0F);
			bytebuffer.putFloat(f_45_ - fs[0] + fs_35_[0]);
			bytebuffer.putFloat(f_46_ - fs[1] + fs_35_[1]);
			bytebuffer.putFloat(f_47_ - fs[2] + fs_35_[2]);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(0.0F);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(f_45_ + fs[0] + fs_35_[0]);
			bytebuffer.putFloat(f_46_ + fs[1] + fs_35_[1]);
			bytebuffer.putFloat(f_47_ + fs[2] + fs_35_[2]);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(f_45_ + fs[0] - fs_35_[0]);
			bytebuffer.putFloat(f_46_ + fs[1] - fs_35_[1]);
			bytebuffer.putFloat(f_47_ + fs[2] - fs_35_[2]);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(0.0F);
		    } else {
			bytebuffer.putFloat(f_45_ + f_26_ * (float) -i_48_);
			bytebuffer.putFloat(f_46_ + f_27_ * (float) -i_48_);
			bytebuffer.putFloat(f_47_ + f_28_ * (float) -i_48_);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(0.0F);
			bytebuffer.putFloat(0.0F);
			bytebuffer.putFloat(f_45_ + f_32_ * (float) i_48_);
			bytebuffer.putFloat(f_46_ + f_33_ * (float) i_48_);
			bytebuffer.putFloat(f_47_ + f_34_ * (float) i_48_);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(0.0F);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(f_45_ + f_26_ * (float) i_48_);
			bytebuffer.putFloat(f_46_ + f_27_ * (float) i_48_);
			bytebuffer.putFloat(f_47_ + f_28_ * (float) i_48_);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(f_45_ + f_29_ * (float) i_48_);
			bytebuffer.putFloat(f_46_ + f_30_ * (float) i_48_);
			bytebuffer.putFloat(f_47_ + f_31_ * (float) i_48_);
			bytebuffer.put(i_40_);
			bytebuffer.put(i_41_);
			bytebuffer.put(i_42_);
			bytebuffer.put(i_43_);
			bytebuffer.putFloat(1.0F);
			bytebuffer.putFloat(0.0F);
		    }
		    i_20_++;
		}
		if (((Class322) this).anIntArray3533[i_36_] > 64) {
		    int i_49_
			= ((Class322) this).anIntArray3533[i_36_] - 64 - 1;
		    for (int i_50_
			     = ((Class322) this).anIntArray3534[i_49_] - 1;
			 i_50_ >= 0; i_50_--) {
			Class479_Sub3_Sub1 class479_sub3_sub1
			    = (((Class322) this)
			       .aClass479_Sub3_Sub1ArrayArray3523[i_49_]
			       [i_50_]);
			int i_51_ = class479_sub3_sub1.anInt11267;
			byte i_52_ = (byte) (i_51_ >> 16);
			byte i_53_ = (byte) (i_51_ >> 8);
			byte i_54_ = (byte) i_51_;
			byte i_55_ = (byte) (i_51_ >>> 24);
			float f_56_
			    = (float) (class479_sub3_sub1.anInt11262 >> 12);
			float f_57_
			    = (float) (class479_sub3_sub1.anInt11263 >> 12);
			float f_58_
			    = (float) (class479_sub3_sub1.anInt11264 >> 12);
			int i_59_ = class479_sub3_sub1.anInt11265 >> 12;
			if (((Class151_Sub2) class151_sub2).anInt8985 == 0) {
			    byte i_60_ = i_52_;
			    i_52_ = i_54_;
			    i_54_ = i_60_;
			}
			if (class479_sub3_sub1.aShort11259 != 0) {
			    ((Class151_Sub2) class151_sub2).aClass403_8946
				.method4889
				(class479_sub3_sub1.aShort11259, i_59_, i_59_,
				 0.0F, 0.0F, 0.0F);
			    ((Class151_Sub2) class151_sub2).aClass403_8946
				.method4863(class151_sub2.aClass403_9081);
			    ((Class151_Sub2) class151_sub2).aClass403_8946
				.method4868(1.0F, 0.0F, 0.0F, fs);
			    ((Class151_Sub2) class151_sub2).aClass403_8946
				.method4868(0.0F, 1.0F, 0.0F, fs_35_);
			    bytebuffer.putFloat(f_56_ - fs[0] - fs_35_[0]);
			    bytebuffer.putFloat(f_57_ - fs[1] - fs_35_[1]);
			    bytebuffer.putFloat(f_58_ - fs[2] - fs_35_[2]);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(0.0F);
			    bytebuffer.putFloat(0.0F);
			    bytebuffer.putFloat(f_56_ - fs[0] + fs_35_[0]);
			    bytebuffer.putFloat(f_57_ - fs[1] + fs_35_[1]);
			    bytebuffer.putFloat(f_58_ - fs[2] + fs_35_[2]);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(0.0F);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(f_56_ + fs[0] + fs_35_[0]);
			    bytebuffer.putFloat(f_57_ + fs[1] + fs_35_[1]);
			    bytebuffer.putFloat(f_58_ + fs[2] + fs_35_[2]);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(f_56_ + fs[0] - fs_35_[0]);
			    bytebuffer.putFloat(f_57_ + fs[1] - fs_35_[1]);
			    bytebuffer.putFloat(f_58_ + fs[2] - fs_35_[2]);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(0.0F);
			} else {
			    bytebuffer
				.putFloat(f_56_ + f_26_ * (float) -i_59_);
			    bytebuffer
				.putFloat(f_57_ + f_27_ * (float) -i_59_);
			    bytebuffer
				.putFloat(f_58_ + f_28_ * (float) -i_59_);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(0.0F);
			    bytebuffer.putFloat(0.0F);
			    bytebuffer.putFloat(f_56_ + f_32_ * (float) i_59_);
			    bytebuffer.putFloat(f_57_ + f_33_ * (float) i_59_);
			    bytebuffer.putFloat(f_58_ + f_34_ * (float) i_59_);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(0.0F);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(f_56_ + f_26_ * (float) i_59_);
			    bytebuffer.putFloat(f_57_ + f_27_ * (float) i_59_);
			    bytebuffer.putFloat(f_58_ + f_28_ * (float) i_59_);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(f_56_ + f_29_ * (float) i_59_);
			    bytebuffer.putFloat(f_57_ + f_30_ * (float) i_59_);
			    bytebuffer.putFloat(f_58_ + f_31_ * (float) i_59_);
			    bytebuffer.put(i_52_);
			    bytebuffer.put(i_53_);
			    bytebuffer.put(i_54_);
			    bytebuffer.put(i_55_);
			    bytebuffer.putFloat(1.0F);
			    bytebuffer.putFloat(0.0F);
			}
			i_20_++;
		    }
		}
	    }
	}
	((Class322) this).anInterface33_3536
	    .method209(0, bytebuffer.position(), class151_sub2.aLong8955);
	class151_sub2.method8380(0, ((Class322) this).anInterface33_3536);
	class151_sub2.method8380(1, ((Class322) this).anInterface33_3524);
	class151_sub2.method8463(((Class322) this).aClass325_3525);
	Class285 class285 = ((Class151_Sub2) class151_sub2).aClass285_9029;
	class285.method3867(i_20_, bool);
    }
}
