Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void readNewModel(byte[] is, int modelId) {
- Buffer nc1 = new Buffer(is);
- Buffer nc2 = new Buffer(is);
- Buffer nc3 = new Buffer(is);
- Buffer nc4 = new Buffer(is);
- Buffer nc5 = new Buffer(is);
- Buffer nc6 = new Buffer(is);
- Buffer nc7 = new Buffer(is);
- nc1.currentOffset = is.length - 23;
- int numVertices = nc1.readShort();
- int numTriangles = nc1.readShort();
- int numTexTriangles = nc1.readUnsignedByte();
- Class21 ModelDef_1 = aClass21Array1661[modelId] = new Class21();
- ModelDef_1.aByteArray368 = is;
- ModelDef_1.anInt369 = numVertices;
- ModelDef_1.anInt370 = numTriangles;
- ModelDef_1.anInt371 = numTexTriangles;
- int i_12_ = nc1.readUnsignedByte();
- int i_13_ = nc1.readUnsignedByte();
- int i_14_ = nc1.readUnsignedByte();
- int i_15_ = nc1.readUnsignedByte();
- int i_16_ = nc1.readUnsignedByte();
- int i_17_ = nc1.readUnsignedByte();
- int i_18_ = nc1.readShort();
- int i_19_ = nc1.readShort();
- int i_20_ = nc1.readShort();
- int i_21_ = nc1.readShort();
- int i_22_ = nc1.readShort();
- int i_23_ = 0;
- int i_24_ = 0;
- int i_25_ = 0;
- int v = 0;
- int hb = 0;
- int P = 0;
- byte G = 0;
- byte[] x = null;
- byte[] O = null;
- byte[] J = null;
- byte[] F = null;
- byte[] cb = null;
- byte[] gb = null;
- byte[] lb = null;
- int[] ab = null;
- int[] kb = null;
- int[] y = null;
- int[] N = null;
- short[] D = null;
- int[] texTrianglesPoint1 = null;
- int[] texTrianglesPoint2 = null;
- int[] texTrianglesPoint3 = null;
- int[] vertexX = new int[numVertices];
- int[] vertexY = new int[numVertices];
- int[] vertexZ = new int[numVertices];
- int[] facePoint1 = new int[numTriangles];
- int[] facePoint2 = new int[numTriangles];
- int[] facePoint3 = new int[numTriangles];
- int[] triangleColours2 = new int[numTriangles];
- if (numTexTriangles > 0) {
- O = new byte[numTexTriangles];
- nc1.currentOffset = 0;
- for (int i_26_ = 0; i_26_ < numTexTriangles; i_26_++) {
- byte i_27_ = O[i_26_] = nc1.readByte();
- if (i_27_ == 0)
- i_23_++;
- if (i_27_ >= 1 && i_27_ <= 3)
- i_24_++;
- if (i_27_ == 2)
- i_25_++;
- }
- }
- int i_28_ = numTexTriangles;
- int i_29_ = i_28_;
- i_28_ += numVertices;
- int i_30_ = i_28_;
- if (i_12_ == 1)
- i_28_ += numTriangles;
- int i_31_ = i_28_;
- i_28_ += numTriangles;
- int i_32_ = i_28_;
- if (i_13_ == 255)
- i_28_ += numTriangles;
- int i_33_ = i_28_;
- if (i_15_ == 1)
- i_28_ += numTriangles;
- int i_34_ = i_28_;
- if (i_17_ == 1)
- i_28_ += numVertices;
- int i_35_ = i_28_;
- if (i_14_ == 1)
- i_28_ += numTriangles;
- int i_36_ = i_28_;
- i_28_ += i_21_;
- int i_37_ = i_28_;
- if (i_16_ == 1)
- i_28_ += numTriangles * 2;
- int i_38_ = i_28_;
- i_28_ += i_22_;
- int i_39_ = i_28_;
- i_28_ += numTriangles * 2;
- int i_40_ = i_28_;
- i_28_ += i_18_;
- int i_41_ = i_28_;
- i_28_ += i_19_;
- int i_42_ = i_28_;
- i_28_ += i_20_;
- int i_43_ = i_28_;
- i_28_ += i_23_ * 6;
- int i_44_ = i_28_;
- i_28_ += i_24_ * 6;
- int i_45_ = i_28_;
- i_28_ += i_24_ * 6;
- int i_46_ = i_28_;
- i_28_ += i_24_;
- int i_47_ = i_28_;
- i_28_ += i_24_;
- int i_48_ = i_28_;
- i_28_ += i_24_ + i_25_ * 2;
- v = numVertices;
- hb = numTriangles;
- P = numTexTriangles;
- vertexX = new int[numVertices];
- vertexY = new int[numVertices];
- vertexZ = new int[numVertices];
- facePoint1 = new int[numTriangles];
- facePoint2 = new int[numTriangles];
- facePoint3 = new int[numTriangles];
- if (i_17_ == 1)
- anIntArray1655 = new int[numVertices];
- if (i_12_ == 1)
- anIntArray1637 = new int[numTriangles];
- if (i_13_ == 255)
- anIntArray1638 = new int[numTriangles];
- else
- G = (byte) i_13_;
- if (i_14_ == 1)
- anIntArray1639 = new int[numTriangles];
- if (i_15_ == 1)
- anIntArray1656 = new int[numTriangles];
- if (i_16_ == 1)
- D = new short[numTriangles];
- if (i_16_ == 1 && numTexTriangles > 0)
- x = new byte[numTriangles];
- triangleColours2 = new int[numTriangles];
- if (numTexTriangles > 0) {
- texTrianglesPoint1 = new int[numTexTriangles];
- texTrianglesPoint2 = new int[numTexTriangles];
- texTrianglesPoint3 = new int[numTexTriangles];
- if (i_24_ > 0) {
- kb = new int[i_24_];
- N = new int[i_24_];
- y = new int[i_24_];
- gb = new byte[i_24_];
- lb = new byte[i_24_];
- F = new byte[i_24_];
- }
- if (i_25_ > 0) {
- cb = new byte[i_25_];
- J = new byte[i_25_];
- }
- }
- nc1.currentOffset = i_29_;
- nc2.currentOffset = i_40_;
- nc3.currentOffset = i_41_;
- nc4.currentOffset = i_42_;
- nc5.currentOffset = i_34_;
- int i_49_ = 0;
- int i_50_ = 0;
- int i_51_ = 0;
- for (int i_52_ = 0; i_52_ < numVertices; i_52_++) {
- int i_53_ = nc1.readUnsignedByte();
- int i_54_ = 0;
- if ((i_53_ & 0x1) != 0)
- i_54_ = nc2.method421();
- int i_55_ = 0;
- if ((i_53_ & 0x2) != 0)
- i_55_ = nc3.method421();
- int i_56_ = 0;
- if ((i_53_ & 0x4) != 0)
- i_56_ = nc4.method421();
- vertexX[i_52_] = i_49_ + i_54_;
- vertexY[i_52_] = i_50_ + i_55_;
- vertexZ[i_52_] = i_51_ + i_56_;
- i_49_ = vertexX[i_52_];
- i_50_ = vertexY[i_52_];
- i_51_ = vertexZ[i_52_];
- if (i_17_ == 1)
- anIntArray1655[i_52_] = nc5.readUnsignedByte();
- }
- nc1.currentOffset = i_39_;
- nc2.currentOffset = i_30_;
- nc3.currentOffset = i_32_;
- nc4.currentOffset = i_35_;
- nc5.currentOffset = i_33_;
- nc6.currentOffset = i_37_;
- nc7.currentOffset = i_38_;
- for (int i_57_ = 0; i_57_ < numTriangles; i_57_++) {
- triangleColours2[i_57_] = (short) nc1.readShort();
- if (i_12_ == 1)
- anIntArray1637[i_57_] = nc2.readByte();
- if (i_13_ == 255)
- anIntArray1638[i_57_] = nc3.readByte();
- if (i_14_ == 1)
- anIntArray1639[i_57_] = nc4.readByte();
- if (i_15_ == 1)
- anIntArray1656[i_57_] = nc5.readUnsignedByte();
- if (i_16_ == 1)
- D[i_57_] = (short) (nc6.readShort() - 1);
- if (x != null) {
- if (D[i_57_] != -1)
- x[i_57_] = (byte) (nc7.readUnsignedByte() - 1);
- else
- x[i_57_] = (byte) -1;
- }
- }
- nc1.currentOffset = i_36_;
- nc2.currentOffset = i_31_;
- int i_58_ = 0;
- int i_59_ = 0;
- int i_60_ = 0;
- int i_61_ = 0;
- for (int i_62_ = 0; i_62_ < numTriangles; i_62_++) {
- int i_63_ = nc2.readUnsignedByte();
- if (i_63_ == 1) {
- i_58_ = nc1.method421() + i_61_;
- i_61_ = i_58_;
- i_59_ = nc1.method421() + i_61_;
- i_61_ = i_59_;
- i_60_ = nc1.method421() + i_61_;
- i_61_ = i_60_;
- facePoint1[i_62_] = i_58_;
- facePoint2[i_62_] = i_59_;
- facePoint3[i_62_] = i_60_;
- }
- if (i_63_ == 2) {
- i_59_ = i_60_;
- i_60_ = nc1.method421() + i_61_;
- i_61_ = i_60_;
- facePoint1[i_62_] = i_58_;
- facePoint2[i_62_] = i_59_;
- facePoint3[i_62_] = i_60_;
- }
- if (i_63_ == 3) {
- i_58_ = i_60_;
- i_60_ = nc1.method421() + i_61_;
- i_61_ = i_60_;
- facePoint1[i_62_] = i_58_;
- facePoint2[i_62_] = i_59_;
- facePoint3[i_62_] = i_60_;
- }
- if (i_63_ == 4) {
- int i_64_ = i_58_;
- i_58_ = i_59_;
- i_59_ = i_64_;
- i_60_ = nc1.method421() + i_61_;
- i_61_ = i_60_;
- facePoint1[i_62_] = i_58_;
- facePoint2[i_62_] = i_59_;
- facePoint3[i_62_] = i_60_;
- }
- }
- nc1.currentOffset = i_43_;
- nc2.currentOffset = i_44_;
- nc3.currentOffset = i_45_;
- nc4.currentOffset = i_46_;
- nc5.currentOffset = i_47_;
- nc6.currentOffset = i_48_;
- for (int i_65_ = 0; i_65_ < numTexTriangles; i_65_++) {
- int i_66_ = O[i_65_] & 0xff;
- if (i_66_ == 0) {
- texTrianglesPoint1[i_65_] = (short) nc1.readShort();
- texTrianglesPoint2[i_65_] = (short) nc1.readShort();
- texTrianglesPoint3[i_65_] = (short) nc1.readShort();
- }
- if (i_66_ == 1) {
- texTrianglesPoint1[i_65_] = (short) nc2.readShort();
- texTrianglesPoint2[i_65_] = (short) nc2.readShort();
- texTrianglesPoint3[i_65_] = (short) nc2.readShort();
- kb[i_65_] = (short) nc3.readShort();
- N[i_65_] = (short) nc3.readShort();
- y[i_65_] = (short) nc3.readShort();
- gb[i_65_] = nc4.readByte();
- lb[i_65_] = nc5.readByte();
- F[i_65_] = nc6.readByte();
- }
- if (i_66_ == 2) {
- texTrianglesPoint1[i_65_] = (short) nc2.readShort();
- texTrianglesPoint2[i_65_] = (short) nc2.readShort();
- texTrianglesPoint3[i_65_] = (short) nc2.readShort();
- kb[i_65_] = (short) nc3.readShort();
- N[i_65_] = (short) nc3.readShort();
- y[i_65_] = (short) nc3.readShort();
- gb[i_65_] = nc4.readByte();
- lb[i_65_] = nc5.readByte();
- F[i_65_] = nc6.readByte();
- cb[i_65_] = nc6.readByte();
- J[i_65_] = nc6.readByte();
- }
- if (i_66_ == 3) {
- texTrianglesPoint1[i_65_] = (short) nc2.readShort();
- texTrianglesPoint2[i_65_] = (short) nc2.readShort();
- texTrianglesPoint3[i_65_] = (short) nc2.readShort();
- kb[i_65_] = (short) nc3.readShort();
- N[i_65_] = (short) nc3.readShort();
- y[i_65_] = (short) nc3.readShort();
- gb[i_65_] = nc4.readByte();
- lb[i_65_] = nc5.readByte();
- F[i_65_] = nc6.readByte();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement