Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com;
- public class Model extends Renderable {
- public static void nullLoader() {
- header = null;
- aBooleanArray1663 = null;
- scale_textures = null;
- vertex_viewpoint_y = null;
- anIntArray1667 = null;
- texture_viewpoint_x = null;
- texture_viewpoint_y = null;
- texture_viewpoint_z = null;
- anIntArray1671 = null;
- anIntArrayArray1672 = null;
- anIntArray1673 = null;
- anIntArrayArray1674 = null;
- anIntArray1675 = null;
- anIntArray1676 = null;
- anIntArray1677 = null;
- SINE = null;
- COSINE = null;
- modelIntArray3 = null;
- modelIntArray4 = null;
- }
- public void decode_old(byte[] data, int modelId) {
- boolean has_face_type = false;
- boolean has_texture_type = false;
- Buffer stream = new Buffer(data);
- Buffer stream1 = new Buffer(data);
- Buffer stream2 = new Buffer(data);
- Buffer stream3 = new Buffer(data);
- Buffer stream4 = new Buffer(data);
- stream.currentPosition = data.length - 18;
- vertices = stream.readUShort();
- faces = stream.readUShort();
- texture_faces = stream.readUnsignedByte();
- int type_opcode = stream.readUnsignedByte();
- int priority_opcode = stream.readUnsignedByte();
- int alpha_opcode = stream.readUnsignedByte();
- int tSkin_opcode = stream.readUnsignedByte();
- int vSkin_opcode = stream.readUnsignedByte();
- int i_254_ = stream.readUShort();
- int i_255_ = stream.readUShort();
- int i_256_ = stream.readUShort();
- int i_257_ = stream.readUShort();
- int i_258_ = 0;
- int i_259_ = i_258_;
- i_258_ += vertices;
- int i_260_ = i_258_;
- i_258_ += faces;
- int i_261_ = i_258_;
- if (priority_opcode == 255)
- i_258_ += faces;
- int i_262_ = i_258_;
- if (tSkin_opcode == 1)
- i_258_ += faces;
- int i_263_ = i_258_;
- if (type_opcode == 1)
- i_258_ += faces;
- int i_264_ = i_258_;
- if (vSkin_opcode == 1)
- i_258_ += vertices;
- int i_265_ = i_258_;
- if (alpha_opcode == 1)
- i_258_ += faces;
- int i_266_ = i_258_;
- i_258_ += i_257_;
- int i_267_ = i_258_;
- i_258_ += faces * 2;
- int i_268_ = i_258_;
- i_258_ += texture_faces * 6;
- int i_269_ = i_258_;
- i_258_ += i_254_;
- int i_270_ = i_258_;
- i_258_ += i_255_;
- int i_271_ = i_258_;
- i_258_ += i_256_;
- particle_vertices = new int[vertices];
- vertexX = new int[vertices];
- vertexY = new int[vertices];
- vertexZ = new int[vertices];
- edge_a = new int[faces];
- edge_b = new int[faces];
- edge_c = new int[faces];
- if (texture_faces > 0) {
- texture_type = new byte[texture_faces];
- texture_edge_a = new short[texture_faces];
- texture_edge_b = new short[texture_faces];
- texture_edge_c = new short[texture_faces];
- }
- if (vSkin_opcode == 1)
- vSkin = new int[vertices];
- if (type_opcode == 1) {
- render_type = new int[faces];
- texture_coordinates = new byte[faces];
- texture = new short[faces];
- }
- if (priority_opcode == 255)
- render_priorities = new byte[faces];
- else
- priority = (byte) priority_opcode;
- if (alpha_opcode == 1)
- alpha = new int[faces];
- if (tSkin_opcode == 1)
- tSkin = new int[faces];
- color = new short[faces];
- stream.currentPosition = i_259_;
- stream1.currentPosition = i_269_;
- stream2.currentPosition = i_270_;
- stream3.currentPosition = i_271_;
- stream4.currentPosition = i_264_;
- int start_x = 0;
- int start_y = 0;
- int start_z = 0;
- for (int point = 0; point < vertices; point++) {
- int flag = stream.readUnsignedByte();
- int x = 0;
- if ((flag & 0x1) != 0)
- x = stream1.readSmart();
- int y = 0;
- if ((flag & 0x2) != 0)
- y = stream2.readSmart();
- int z = 0;
- if ((flag & 0x4) != 0)
- z = stream3.readSmart();
- vertexX[point] = start_x + x;
- vertexY[point] = start_y + y;
- vertexZ[point] = start_z + z;
- start_x = vertexX[point];
- start_y = vertexY[point];
- start_z = vertexZ[point];
- if (vSkin_opcode == 1)
- vSkin[point] = stream4.readUnsignedByte();
- }
- stream.currentPosition = i_267_;
- stream1.currentPosition = i_263_;
- stream2.currentPosition = i_261_;
- stream3.currentPosition = i_265_;
- stream4.currentPosition = i_262_;
- for (int face = 0; face < faces; face++) {
- color[face] = (short) stream.readUShort();
- if (type_opcode == 1) {
- int flag = stream1.readUnsignedByte();
- if ((flag & 0x1) == 1) {
- render_type[face] = 1;
- has_face_type = true;
- } else {
- render_type[face] = 0;
- }
- if ((flag & 0x2) != 0) {
- texture_coordinates[face] = (byte) (flag >> 2);
- texture[face] = color[face];
- color[face] = 127;
- if (texture[face] != -1)
- has_texture_type = true;
- } else {
- texture_coordinates[face] = -1;
- texture[face] = -1;
- }
- }
- if (priority_opcode == 255)
- render_priorities[face] = stream2.readSignedByte();
- if (alpha_opcode == 1) {
- alpha[face] = stream3.readSignedByte();
- if (alpha[face] < 0)
- alpha[face] = (256 + alpha[face]);
- }
- if (tSkin_opcode == 1)
- tSkin[face] = stream4.readUnsignedByte();
- }
- stream.currentPosition = i_266_;
- stream1.currentPosition = i_260_;
- int coordinate_a = 0;
- int coordinate_b = 0;
- int coordinate_c = 0;
- int offset = 0;
- int coordinate;
- for (int face = 0; face < faces; face++) {
- int opcode = stream1.readUnsignedByte();
- if (opcode == 1) {
- coordinate_a = (stream.readSmart() + offset);
- offset = coordinate_a;
- coordinate_b = (stream.readSmart() + offset);
- offset = coordinate_b;
- coordinate_c = (stream.readSmart() + offset);
- offset = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- if (opcode == 2) {
- coordinate_b = coordinate_c;
- coordinate_c = (stream.readSmart() + offset);
- offset = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- if (opcode == 3) {
- coordinate_a = coordinate_c;
- coordinate_c = (stream.readSmart() + offset);
- offset = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- if (opcode == 4) {
- coordinate = coordinate_a;
- coordinate_a = coordinate_b;
- coordinate_b = coordinate;
- coordinate_c = (stream.readSmart() + offset);
- offset = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- }
- stream.currentPosition = i_268_;
- for (int face = 0; face < texture_faces; face++) {
- texture_type[face] = 0;
- texture_edge_a[face] = (short) stream.readUShort();
- texture_edge_b[face] = (short) stream.readUShort();
- texture_edge_c[face] = (short) stream.readUShort();
- }
- if (texture_coordinates != null) {
- boolean textured = false;
- for (int face = 0; face < faces; face++) {
- coordinate = texture_coordinates[face] & 0xff;
- if (coordinate != 255) {
- if (((texture_edge_a[coordinate] & 0xffff) == edge_a[face]) && ((texture_edge_b[coordinate] & 0xffff) == edge_b[face]) && ((texture_edge_c[coordinate] & 0xffff) == edge_c[face])) {
- texture_coordinates[face] = -1;
- } else {
- textured = true;
- }
- }
- }
- if (!textured)
- texture_coordinates = null;
- }
- if (!has_texture_type)
- texture = null;
- if (!has_face_type)
- render_type = null;
- }
- public void decode_new(byte data[], int modelId) {
- Buffer vertex_data_1 = new Buffer(data);
- Buffer vertex_data_2 = new Buffer(data);
- Buffer vertex_data_3 = new Buffer(data);
- Buffer vertex_data_4 = new Buffer(data);
- Buffer skin_data = new Buffer(data);
- Buffer texture_data = new Buffer(data);
- Buffer texture_coordinate_data = new Buffer(data);
- vertex_data_1.currentPosition = data.length - 23;
- vertices = vertex_data_1.readUShort();
- faces = vertex_data_1.readUShort();
- texture_faces = vertex_data_1.readUnsignedByte();
- ModelHeader def = header[modelId] = new ModelHeader();
- def.aByteArray368 = data;
- def.anInt369 = vertices;
- def.anInt370 = faces;
- def.anInt371 = texture_faces;
- int model_render_type = vertex_data_1.readUnsignedByte();
- int model_priority = vertex_data_1.readUnsignedByte();
- int model_alpha = vertex_data_1.readUnsignedByte();
- int model_muscle = vertex_data_1.readUnsignedByte();
- int model_texture = vertex_data_1.readUnsignedByte();
- int model_bones = vertex_data_1.readUnsignedByte();
- int model_vertex_x = vertex_data_1.readUShort();
- int model_vertex_y = vertex_data_1.readUShort();
- int model_vertex_z = vertex_data_1.readUShort();
- int model_vertex_points = vertex_data_1.readUShort();
- int model_texture_coordinates = vertex_data_1.readUShort();
- int texture_id = 0;
- int texture_triangles = 0;
- int texture_unknown = 0;
- int face;
- if (texture_faces > 0) {
- texture_type = new byte[texture_faces];
- vertex_data_1.currentPosition = 0;
- for (face = 0; face < texture_faces; face++) {
- byte opcode = texture_type[face] = vertex_data_1.readSignedByte();
- if (opcode == 0) {
- texture_id++;
- }
- if (opcode >= 1 && opcode <= 3) {
- texture_triangles++;
- }
- if (opcode == 2) {
- texture_unknown++;
- }
- }
- }
- int pos = texture_faces;
- int model_vertex_offset = pos;
- pos += vertices;
- int model_render_type_offset = pos;
- if (model_render_type == 1)
- pos += faces;
- int model_face_offset = pos;
- pos += faces;
- int model_face_priorities_offset = pos;
- if (model_priority == 255)
- pos += faces;
- int model_muscle_offset = pos;
- if (model_muscle == 1)
- pos += faces;
- int model_bones_offset = pos;
- if (model_bones == 1)
- pos += vertices;
- int model_alpha_offset = pos;
- if (model_alpha == 1)
- pos += faces;
- int model_points_offset = pos;
- pos += model_vertex_points;
- int model_texture_id = pos;
- if (model_texture == 1)
- pos += faces * 2;
- int model_texture_coordinate_offset = pos;
- pos += model_texture_coordinates;
- int model_color_offset = pos;
- pos += faces * 2;
- int model_vertex_x_offset = pos;
- pos += model_vertex_x;
- int model_vertex_y_offset = pos;
- pos += model_vertex_y;
- int model_vertex_z_offset = pos;
- pos += model_vertex_z;
- int model_texture_offset = pos;
- pos += texture_id * 6;
- int model_texture_unknown_1 = pos;
- pos += texture_triangles * 6;
- int model_texture_unknown_2 = pos;
- pos += texture_triangles * 6;
- int model_texture_unknown_3 = pos;
- pos += texture_triangles * 2;
- int model_texture_unknown_4 = pos;
- pos += texture_triangles;
- int model_texture_unknown_5 = pos;
- pos += texture_triangles * 2 + texture_unknown * 2;
- particle_vertices = new int[vertices];
- vertexX = new int[vertices];
- vertexY = new int[vertices];
- vertexZ = new int[vertices];
- edge_a = new int[faces];
- edge_b = new int[faces];
- edge_c = new int[faces];
- if (model_bones == 1)
- vSkin = new int[vertices];
- if (model_render_type == 1)
- render_type = new int[faces];
- if (model_priority == 255)
- render_priorities = new byte[faces];
- else
- priority = (byte) model_priority;
- if (model_alpha == 1)
- alpha = new int[faces];
- if (model_muscle == 1)
- tSkin = new int[faces];
- if (model_texture == 1)
- texture = new short[faces];
- if (model_texture == 1 && texture_faces > 0)
- texture_coordinates = new byte[faces];
- color = new short[faces];
- if (texture_faces > 0) {
- texture_edge_a = new short[texture_faces];
- texture_edge_b = new short[texture_faces];
- texture_edge_c = new short[texture_faces];
- }
- vertex_data_1.currentPosition = model_vertex_offset;
- vertex_data_2.currentPosition = model_vertex_x_offset;
- vertex_data_3.currentPosition = model_vertex_y_offset;
- vertex_data_4.currentPosition = model_vertex_z_offset;
- skin_data.currentPosition = model_bones_offset;
- int start_x = 0;
- int start_y = 0;
- int start_z = 0;
- for (int point = 0; point < vertices; point++) {
- int position_mask = vertex_data_1.readUnsignedByte();
- int x = 0;
- if ((position_mask & 1) != 0) {
- x = vertex_data_2.readSmart();
- }
- int y = 0;
- if ((position_mask & 2) != 0) {
- y = vertex_data_3.readSmart();
- }
- int z = 0;
- if ((position_mask & 4) != 0) {
- z = vertex_data_4.readSmart();
- }
- vertexX[point] = start_x + x;
- vertexY[point] = start_y + y;
- vertexZ[point] = start_z + z;
- start_x = vertexX[point];
- start_y = vertexY[point];
- start_z = vertexZ[point];
- if (vSkin != null)
- vSkin[point] = skin_data.readUnsignedByte();
- }
- vertex_data_1.currentPosition = model_color_offset;
- vertex_data_2.currentPosition = model_render_type_offset;
- vertex_data_3.currentPosition = model_face_priorities_offset;
- vertex_data_4.currentPosition = model_alpha_offset;
- skin_data.currentPosition = model_muscle_offset;
- texture_data.currentPosition = model_texture_id;
- texture_coordinate_data.currentPosition = model_texture_coordinate_offset;
- for (face = 0; face < faces; face++) {
- color[face] = (short) vertex_data_1.readUShort();
- if (model_render_type == 1) {
- render_type[face] = vertex_data_2.readSignedByte();
- }
- if (model_priority == 255) {
- render_priorities[face] = vertex_data_3.readSignedByte();
- }
- if (model_alpha == 1) {
- alpha[face] = vertex_data_4.readSignedByte();
- if (alpha[face] < 0)
- alpha[face] = (256 + alpha[face]);
- }
- if (model_muscle == 1)
- tSkin[face] = skin_data.readUnsignedByte();
- if (model_texture == 1) {
- texture[face] = (short) (texture_data.readUShort() - 1);
- if(texture[face] >= 0) {
- if(render_type != null) {
- if(render_type[face] < 2
- && color[face] != 127
- && color[face] != -27075
- && color[face] != 8128
- && color[face] != 7510) {
- texture[face] = -1;
- }
- }
- }
- if(texture[face] != -1)
- color[face] = 127;
- }
- if (texture_coordinates != null && texture[face] != -1) {
- texture_coordinates[face] = (byte) (texture_coordinate_data.readUnsignedByte() - 1);
- }
- }
- vertex_data_1.currentPosition = model_points_offset;
- vertex_data_2.currentPosition = model_face_offset;
- int coordinate_a = 0;
- int coordinate_b = 0;
- int coordinate_c = 0;
- int last_coordinate = 0;
- for (face = 0; face < faces; face++) {
- int opcode = vertex_data_2.readUnsignedByte();
- if (opcode == 1) {
- coordinate_a = vertex_data_1.readSmart() + last_coordinate;
- last_coordinate = coordinate_a;
- coordinate_b = vertex_data_1.readSmart() + last_coordinate;
- last_coordinate = coordinate_b;
- coordinate_c = vertex_data_1.readSmart() + last_coordinate;
- last_coordinate = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- if (opcode == 2) {
- coordinate_b = coordinate_c;
- coordinate_c = vertex_data_1.readSmart() + last_coordinate;
- last_coordinate = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- if (opcode == 3) {
- coordinate_a = coordinate_c;
- coordinate_c = vertex_data_1.readSmart() + last_coordinate;
- last_coordinate = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- if (opcode == 4) {
- int l14 = coordinate_a;
- coordinate_a = coordinate_b;
- coordinate_b = l14;
- coordinate_c = vertex_data_1.readSmart() + last_coordinate;
- last_coordinate = coordinate_c;
- edge_a[face] = coordinate_a;
- edge_b[face] = coordinate_b;
- edge_c[face] = coordinate_c;
- }
- }
- vertex_data_1.currentPosition = model_texture_offset;
- vertex_data_2.currentPosition = model_texture_unknown_1;
- vertex_data_3.currentPosition = model_texture_unknown_2;
- vertex_data_4.currentPosition = model_texture_unknown_3;
- skin_data.currentPosition = model_texture_unknown_4;
- texture_data.currentPosition = model_texture_unknown_5;
- for (face = 0; face < texture_faces; face++) {
- int opcode = texture_type[face] & 0xff;
- if (opcode == 0) {
- texture_edge_a[face] = (short) vertex_data_1.readUShort();
- texture_edge_b[face] = (short) vertex_data_1.readUShort();
- texture_edge_c[face] = (short) vertex_data_1.readUShort();
- }
- if (opcode == 1) {
- texture_edge_a[face] = (short) vertex_data_2.readUShort();
- texture_edge_b[face] = (short) vertex_data_2.readUShort();
- texture_edge_c[face] = (short) vertex_data_2.readUShort();
- }
- if (opcode == 2) {
- texture_edge_a[face] = (short) vertex_data_2.readUShort();
- texture_edge_b[face] = (short) vertex_data_2.readUShort();
- texture_edge_c[face] = (short) vertex_data_2.readUShort();
- }
- if (opcode == 3) {
- texture_edge_a[face] = (short) vertex_data_2.readUShort();
- texture_edge_b[face] = (short) vertex_data_2.readUShort();
- texture_edge_c[face] = (short) vertex_data_2.readUShort();
- }
- }
- vertex_data_1.currentPosition = pos;
- face = vertex_data_1.readUnsignedByte();
- }
- public Model(int modelId) {
- byte[] data = header[modelId].aByteArray368;
- if (data[data.length - 1] == -1 && data[data.length - 2] == -1) {
- decode_new(data, modelId);
- } else {
- decode_old(data, modelId);
- }
- }
- public static void method460(byte abyte0[], int j) {
- try {
- if (abyte0 == null) {
- ModelHeader class21 = header[j] = new ModelHeader();
- class21.anInt369 = 0;
- class21.anInt370 = 0;
- class21.anInt371 = 0;
- return;
- }
- Buffer stream = new Buffer(abyte0);
- stream.currentPosition = abyte0.length - 18;
- ModelHeader class21_1 = header[j] = new ModelHeader();
- class21_1.aByteArray368 = abyte0;
- class21_1.anInt369 = stream.readUShort();
- class21_1.anInt370 = stream.readUShort();
- class21_1.anInt371 = stream.readUnsignedByte();
- int k = stream.readUnsignedByte();
- int l = stream.readUnsignedByte();
- int i1 = stream.readUnsignedByte();
- int j1 = stream.readUnsignedByte();
- int k1 = stream.readUnsignedByte();
- int l1 = stream.readUShort();
- int i2 = stream.readUShort();
- int j2 = stream.readUShort();
- int k2 = stream.readUShort();
- int l2 = 0;
- class21_1.anInt372 = l2;
- l2 += class21_1.anInt369;
- class21_1.anInt378 = l2;
- l2 += class21_1.anInt370;
- class21_1.anInt381 = l2;
- if (l == 255)
- l2 += class21_1.anInt370;
- else
- class21_1.anInt381 = -l - 1;
- class21_1.anInt383 = l2;
- if (j1 == 1)
- l2 += class21_1.anInt370;
- else
- class21_1.anInt383 = -1;
- class21_1.anInt380 = l2;
- if (k == 1)
- l2 += class21_1.anInt370;
- else
- class21_1.anInt380 = -1;
- class21_1.anInt376 = l2;
- if (k1 == 1)
- l2 += class21_1.anInt369;
- else
- class21_1.anInt376 = -1;
- class21_1.anInt382 = l2;
- if (i1 == 1)
- l2 += class21_1.anInt370;
- else
- class21_1.anInt382 = -1;
- class21_1.anInt377 = l2;
- l2 += k2;
- class21_1.anInt379 = l2;
- l2 += class21_1.anInt370 * 2;
- class21_1.anInt384 = l2;
- l2 += class21_1.anInt371 * 6;
- class21_1.anInt373 = l2;
- l2 += l1;
- class21_1.anInt374 = l2;
- l2 += i2;
- class21_1.anInt375 = l2;
- l2 += j2;
- } catch (Exception _ex) {
- _ex.printStackTrace();
- }
- }
- public static void method459(int id, Provider onDemandFetcherParent) {
- header = new ModelHeader[id];
- resourceProvider = onDemandFetcherParent;
- }
- public static void method461(int file) {//clear
- header[file] = null;
- }
- public static Model getModel(int file) {
- if (header == null)
- return null;
- ModelHeader class21 = header[file];
- if (class21 == null) {
- resourceProvider.provide(file);
- return null;
- } else {
- return new Model(file);
- }
- }
- public static boolean cached(int file) {
- if (header == null)
- return false;
- ModelHeader class21 = header[file];
- if (class21 == null) {
- resourceProvider.provide(file);
- return false;
- } else {
- return true;
- }
- }
- private Model(boolean flag) {
- aBoolean1618 = true;//?
- fits_on_single_square = false;
- if (!flag)
- aBoolean1618 = !aBoolean1618;
- }
- public Model(int length, Model model_segments[]) {
- this(length, model_segments, false);
- }
- public Model(int length, Model model_segments[], boolean player) {
- try {
- aBoolean1618 = true;
- fits_on_single_square = false;
- anInt1620++;
- boolean type_flag = false;
- boolean priority_flag = false;
- boolean alpha_flag = false;
- boolean tSkin_flag = false;
- boolean color_flag = false;
- boolean texture_flag = false;
- boolean coordinate_flag = false;
- vertices = 0;
- faces = 0;
- texture_faces = 0;
- priority = -1;
- Model build;
- for (int segment_index = 0; segment_index < length; segment_index++) {
- build = model_segments[segment_index];
- if (build != null) {
- vertices += build.vertices;
- faces += build.faces;
- texture_faces += build.texture_faces;
- type_flag |= build.render_type != null;
- alpha_flag |= build.alpha != null;
- if (build.render_priorities != null) {
- priority_flag = true;
- } else {
- if (priority == -1)
- priority = build.priority;
- if (priority != build.priority)
- priority_flag = true;
- }
- tSkin_flag |= build.tSkin != null;
- color_flag |= build.color != null;
- texture_flag |= build.texture != null;
- coordinate_flag |= build.texture_coordinates != null;
- }
- }
- particle_vertices = new int[vertices];
- vertexX = new int[vertices];
- vertexY = new int[vertices];
- vertexZ = new int[vertices];
- vSkin = new int[vertices];
- edge_a = new int[faces];
- edge_b = new int[faces];
- edge_c = new int[faces];
- if(color_flag)
- color = new short[faces];
- if (type_flag)
- render_type = new int[faces];
- if (priority_flag)
- render_priorities = new byte[faces];
- if (alpha_flag)
- alpha = new int[faces];
- if (tSkin_flag)
- tSkin = new int[faces];
- if(texture_flag)
- texture = new short[faces];
- if (coordinate_flag)
- texture_coordinates = new byte[faces];
- if(texture_faces > 0) {
- texture_type = new byte[texture_faces];
- texture_edge_a = new short[texture_faces];
- texture_edge_b = new short[texture_faces];
- texture_edge_c = new short[texture_faces];
- }
- vertices = 0;
- faces = 0;
- texture_faces = 0;
- for (int segment_index = 0; segment_index < length; segment_index++) {
- build = model_segments[segment_index];
- if (build != null) {
- for (int face = 0; face < build.faces; face++) {
- /*if (type_flag) {
- if (build.render_type == null) {
- render_type[faces] = 0;
- } else {
- int type = build.render_type[face];
- if ((type & 2) == 2)
- type += texture_faces << 2;
- render_type[faces] = type;
- }
- }*/
- if(type_flag && build.render_type != null)
- render_type[faces] = build.render_type[face];
- if (priority_flag)
- if (build.render_priorities == null)
- render_priorities[faces] = build.priority;
- else
- render_priorities[faces] = build.render_priorities[face];
- if (alpha_flag && build.alpha != null)
- alpha[faces] = build.alpha[face];
- if (tSkin_flag && build.tSkin != null)
- tSkin[faces] = build.tSkin[face];
- if(texture_flag) {
- if(build.texture != null)
- texture[faces] = build.texture[face];
- else
- texture[faces] = -1;
- }
- if(coordinate_flag) {
- if(build.texture_coordinates != null && build.texture_coordinates[face] != -1) {
- texture_coordinates[faces] = (byte) (build.texture_coordinates[face] + texture_faces);
- } else {
- texture_coordinates[faces] = -1;
- }
- }
- if(color_flag && build.color != null)
- color[faces] = build.color[face];
- edge_a[faces] = method465(build, build.edge_a[face]);
- edge_b[faces] = method465(build, build.edge_b[face]);
- edge_c[faces] = method465(build, build.edge_c[face]);
- faces++;
- }
- for (int texture_edge = 0; texture_edge < build.texture_faces; texture_edge++) {
- byte opcode = texture_type[texture_faces] = build.texture_type[texture_edge];
- if(opcode == 0) {
- texture_edge_a[texture_faces] = (short) method465(build, build.texture_edge_a[texture_edge]);
- texture_edge_b[texture_faces] = (short) method465(build, build.texture_edge_b[texture_edge]);
- texture_edge_c[texture_faces] = (short) method465(build, build.texture_edge_c[texture_edge]);
- }
- if(opcode >= 1 && opcode <= 3) {
- texture_edge_a[texture_faces] = build.texture_edge_a[texture_edge];
- texture_edge_b[texture_faces] = build.texture_edge_b[texture_edge];
- texture_edge_c[texture_faces] = build.texture_edge_c[texture_edge];
- }
- if(opcode == 2) {
- }
- if(player)
- texture_faces++;
- }
- if(!player)
- texture_faces++;
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- //Players - graphics in particular
- public Model(Model model_segments[]) {
- int length = 2;
- aBoolean1618 = true;
- fits_on_single_square = false;
- anInt1620++;
- boolean type_flag = false;
- boolean priority_flag = false;
- boolean alpha_flag = false;
- boolean color_flag = false;
- boolean texture_flag = false;
- boolean coordinate_flag = false;
- vertices = 0;
- faces = 0;
- texture_faces = 0;
- int i_668_ = 0;
- int i_669_ = 0;
- priority = -1;
- Model build;
- for (int segment_index = 0; segment_index < length; segment_index++) {
- build = model_segments[segment_index];
- if (build != null) {
- vertices += build.vertices;
- faces += build.faces;
- texture_faces += build.texture_faces;
- type_flag |= render_type != null;
- if (build.render_priorities != null) {
- priority_flag = true;
- } else {
- if (priority == -1)
- priority = build.priority;
- if (priority != build.priority)
- priority_flag = true;
- }
- alpha_flag |= build.alpha != null;
- color_flag |= build.color != null;
- texture_flag |= build.texture != null;
- coordinate_flag |= build.texture_coordinates != null;
- if(build.aClass158Array3788 != null)
- i_668_ += build.aClass158Array3788.length;
- if(build.aClass169Array3776 != null)
- i_669_ += build.aClass169Array3776.length;
- }
- }
- particle_vertices = new int[vertices];
- vertexX = new int[vertices];
- vertexY = new int[vertices];
- vertexZ = new int[vertices];
- edge_a = new int[faces];
- edge_b = new int[faces];
- edge_c = new int[faces];
- hue_a = new int[faces];
- hue_b = new int[faces];
- hue_c = new int[faces];
- if (type_flag)
- render_type = new int[faces];
- if (priority_flag)
- render_priorities = new byte[faces];
- if (alpha_flag)
- alpha = new int[faces];
- if (texture_flag)
- texture = new short[faces];
- if (coordinate_flag)
- texture_coordinates = new byte[faces];
- if(texture_faces > 0) {
- texture_type = new byte[texture_faces];
- texture_edge_a = new short[texture_faces];
- texture_edge_b = new short[texture_faces];
- texture_edge_c = new short[texture_faces];
- }
- if(i_668_ > 0) {
- this.aClass158Array3788 = new ModelParticleEmitter[i_668_];
- }
- if(i_669_ > 0) {
- this.aClass169Array3776 = new ModelParticleMagnet[i_669_];
- }
- if (color_flag)
- color = new short[faces];
- vertices = 0;
- faces = 0;
- texture_faces = 0;
- for (int segment_index = 0; segment_index < length; segment_index++) {
- build = model_segments[segment_index];
- if (build != null) {
- int vertex = vertices;
- for (int point = 0; point < build.vertices; point++) {
- particle_vertices[vertices] = build.particle_vertices[point];
- vertexX[vertices] = build.vertexX[point];
- vertexY[vertices] = build.vertexY[point];
- vertexZ[vertices] = build.vertexZ[point];
- vertices++;
- }
- for (int face = 0; face < build.faces; face++) {
- edge_a[faces] = build.edge_a[face] + vertex;
- edge_b[faces] = build.edge_b[face] + vertex;
- edge_c[faces] = build.edge_c[face] + vertex;
- hue_a[faces] = build.hue_a[face];
- hue_b[faces] = build.hue_b[face];
- hue_c[faces] = build.hue_c[face];
- /*if (type_flag)
- if (build.render_type == null) {
- render_type[faces] = 0;
- } else {
- int type = build.render_type[face];
- if ((type & 2) == 2) //texture
- type += texture_faces << 2;
- render_type[faces] = type;
- }*/
- if(type_flag && build.render_type != null) {
- render_type[faces] = build.render_type[face];
- }
- if (alpha_flag && build.alpha != null) {
- alpha[faces] = build.alpha[face];
- }
- if (priority_flag)
- if (build.render_priorities == null)
- render_priorities[faces] = build.priority;
- else
- render_priorities[faces] = build.render_priorities[face];
- if (color_flag && build.color != null)
- color[faces] = build.color[face];
- if(texture_flag) {
- if(build.texture != null) {
- texture[faces] = build.texture[face];
- } else
- texture[faces] = -1;
- }
- if(coordinate_flag) {
- if(build.texture_coordinates != null && build.texture_coordinates[face] != -1) {
- texture_coordinates[faces] = (byte) (build.texture_coordinates[face] + texture_faces);
- } else
- texture_coordinates[faces] = -1;
- }
- faces++;
- }
- for (int texture_edge = 0; texture_edge < build.texture_faces; texture_edge++) {
- texture_edge_a[texture_faces] = (short) (build.texture_edge_a[texture_edge] + vertex);
- texture_edge_b[texture_faces] = (short) (build.texture_edge_b[texture_edge] + vertex);
- texture_edge_c[texture_faces] = (short) (build.texture_edge_c[texture_edge] + vertex);
- texture_faces++;
- }
- texture_faces += build.texture_faces;//texture_faces++;
- }
- }
- method466();
- }
- public Model(boolean color_flag, boolean alpha_flag, boolean animated, Model model) {
- this(color_flag, alpha_flag, animated, false, model);
- }
- public Model(boolean color_flag, boolean alpha_flag, boolean animated, boolean texture_flag, Model model) {
- aBoolean1618 = true;
- fits_on_single_square = false;
- anInt1620++;
- vertices = model.vertices;
- faces = model.faces;
- texture_faces = model.texture_faces;
- if (animated) {
- particle_vertices = model.particle_vertices;
- vertexX = model.vertexX;
- vertexY = model.vertexY;
- vertexZ = model.vertexZ;
- } else {
- particle_vertices = new int[vertices];
- vertexX = new int[vertices];
- vertexY = new int[vertices];
- vertexZ = new int[vertices];
- for (int point = 0; point < vertices; point++) {
- particle_vertices[point] = model.particle_vertices[point];
- vertexX[point] = model.vertexX[point];
- vertexY[point] = model.vertexY[point];
- vertexZ[point] = model.vertexZ[point];
- }
- }
- if (color_flag) {
- color = model.color;
- } else {
- color = new short[faces];
- for (int face = 0; face < faces; face++)
- color[face] = model.color[face];
- }
- if(!texture_flag && model.texture != null) {
- texture = new short[faces];
- for(int face = 0; face < faces; face++) {
- texture[face] = model.texture[face];
- }
- } else {
- texture = model.texture;
- }
- if (alpha_flag) {
- alpha = model.alpha;
- } else {
- alpha = new int[faces];
- if (model.alpha == null) {
- for (int l = 0; l < faces; l++)
- alpha[l] = 0;
- } else {
- for (int i1 = 0; i1 < faces; i1++)
- alpha[i1] = model.alpha[i1];
- }
- }
- vSkin = model.vSkin;
- tSkin = model.tSkin;
- render_type = model.render_type;
- edge_a = model.edge_a;
- edge_b = model.edge_b;
- edge_c = model.edge_c;
- render_priorities = model.render_priorities;
- texture_coordinates = model.texture_coordinates;
- texture_type = model.texture_type;
- priority = model.priority;
- texture_edge_a = model.texture_edge_a;
- texture_edge_b = model.texture_edge_b;
- texture_edge_c = model.texture_edge_c;
- this.aClass158Array3788 = model.aClass158Array3788;
- this.aClass169Array3776 = model.aClass169Array3776;
- }
- public Model(boolean adjust_elevation, boolean gouraud_shading, Model model) {
- aBoolean1618 = true;
- fits_on_single_square = false;
- anInt1620++;
- vertices = model.vertices;
- faces = model.faces;
- texture_faces = model.texture_faces;
- if (adjust_elevation) {
- vertexY = new int[vertices];
- for (int point = 0; point < vertices; point++)
- vertexY[point] = model.vertexY[point];
- } else {
- vertexY = model.vertexY;
- }
- if (gouraud_shading) {
- hue_a = new int[faces];
- hue_b = new int[faces];
- hue_c = new int[faces];
- for (int face = 0; face < faces; face++) {
- hue_a[face] = model.hue_a[face];
- hue_b[face] = model.hue_b[face];
- hue_c[face] = model.hue_c[face];
- }
- render_type = new int[faces];
- if (model.render_type == null) {
- for (int face = 0; face < faces; face++)
- render_type[face] = 0;
- } else {
- for (int face = 0; face < faces; face++)
- render_type[face] = model.render_type[face];
- }
- super.aClass33Array1425 = new Vertex[vertices];
- for (int point = 0; point < vertices; point++) {
- Vertex class33 = super.aClass33Array1425[point] = new Vertex();
- Vertex class33_1 = model.aClass33Array1425[point];
- class33.anInt602 = class33_1.anInt602;
- class33.anInt603 = class33_1.anInt603;
- class33.anInt604 = class33_1.anInt604;
- class33.anInt605 = class33_1.anInt605;
- }
- gouraud_vertex = model.gouraud_vertex;
- } else {
- hue_a = model.hue_a;
- hue_b = model.hue_b;
- hue_c = model.hue_c;
- render_type = model.render_type;
- }
- particle_vertices = model.particle_vertices;
- vertexX = model.vertexX;
- vertexZ = model.vertexZ;
- edge_a = model.edge_a;
- edge_b = model.edge_b;
- edge_c = model.edge_c;
- render_priorities = model.render_priorities;
- alpha = model.alpha;
- texture_coordinates = model.texture_coordinates;
- color = model.color;
- texture = model.texture;
- priority = model.priority;
- texture_type = model.texture_type;
- texture_edge_a = model.texture_edge_a;
- texture_edge_b = model.texture_edge_b;
- texture_edge_c = model.texture_edge_c;
- super.modelHeight = model.modelHeight;
- anInt1650 = model.anInt1650;
- anInt1653 = model.anInt1653;
- anInt1652 = model.anInt1652;
- anInt1646 = model.anInt1646;
- anInt1648 = model.anInt1648;
- anInt1649 = model.anInt1649;
- anInt1647 = model.anInt1647;
- }
- public void method464(Model model, boolean alpha_flag) {
- vertices = model.vertices;
- faces = model.faces;
- texture_faces = model.texture_faces;
- if (anIntArray1622.length < vertices) {
- anIntArray1622 = new int[vertices + 10000];
- anIntArray1623 = new int[vertices + 10000];
- anIntArray1624 = new int[vertices + 10000];
- }
- particle_vertices = new int[vertices];
- vertexX = anIntArray1622;
- vertexY = anIntArray1623;
- vertexZ = anIntArray1624;
- for (int point = 0; point < vertices; point++) {
- if (particle_vertices != null)
- particle_vertices[point] = model.particle_vertices[point];
- vertexX[point] = model.vertexX[point];
- vertexY[point] = model.vertexY[point];
- vertexZ[point] = model.vertexZ[point];
- }
- if (alpha_flag) {
- alpha = model.alpha;
- } else {
- if (anIntArray1625.length < faces)
- anIntArray1625 = new int[faces + 100];
- alpha = anIntArray1625;
- if (model.alpha == null) {
- for (int face = 0; face < faces; face++)
- alpha[face] = 0;
- } else {
- for (int face = 0; face < faces; face++)
- alpha[face] = model.alpha[face];
- }
- }
- render_type = model.render_type;
- color = model.color;
- render_priorities = model.render_priorities;
- priority = model.priority;
- face_skin = model.face_skin;
- vertex_skin = model.vertex_skin;
- edge_a = model.edge_a;
- edge_b = model.edge_b;
- edge_c = model.edge_c;
- hue_a = model.hue_a;
- hue_b = model.hue_b;
- hue_c = model.hue_c;
- texture_edge_a = model.texture_edge_a;
- texture_edge_b = model.texture_edge_b;
- texture_edge_c = model.texture_edge_c;
- texture_coordinates = model.texture_coordinates;
- texture_type = model.texture_type;
- texture = model.texture;
- }
- private final int method465(Model model, int face) {
- int vertex = -1;
- int particle_point = model.particle_vertices[face];
- int x = model.vertexX[face];
- int y = model.vertexY[face];
- int z = model.vertexZ[face];
- for (int index = 0; index < vertices; index++) {
- if (x != vertexX[index] || y != vertexY[index] || z != vertexZ[index])
- continue;
- vertex = index;
- break;
- }
- if (vertex == -1) {
- particle_vertices[vertices] = particle_point;
- vertexX[vertices] = x;
- vertexY[vertices] = y;
- vertexZ[vertices] = z;
- if (model.vSkin != null)
- vSkin[vertices] = model.vSkin[face];
- vertex = vertices++;
- }
- return vertex;
- }
- public void method466() {
- super.modelHeight = 0;
- anInt1650 = 0;
- anInt1651 = 0;
- for (int index = 0; index < vertices; index++) {
- int x = vertexX[index];
- int y = vertexY[index];
- int z = vertexZ[index];
- if (-y > super.modelHeight)
- super.modelHeight = -y;
- if (y > anInt1651)
- anInt1651 = y;
- int i1 = x * x + z * z;
- if (i1 > anInt1650)
- anInt1650 = i1;
- }
- anInt1650 = (int) (Math.sqrt(anInt1650) + 0.98999999999999999D);
- anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight) + 0.98999999999999999D);//aShort3763
- anInt1652 = anInt1653 + (int) (Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651) + 0.98999999999999999D);//aShort3785
- }
- public void computeSphericalBounds() {
- super.modelHeight = 0;
- anInt1651 = 0;
- for (int index = 0; index < vertices; index++) {
- int j = vertexY[index];
- if (-j > super.modelHeight)
- super.modelHeight = -j;
- if (j > anInt1651)
- anInt1651 = j;
- }
- anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight) + 0.98999999999999999D);
- anInt1652 = anInt1653 + (int) (Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651) + 0.98999999999999999D);
- }
- public void method468(int i) {
- super.modelHeight = 0;
- anInt1650 = 0;
- anInt1651 = 0;
- anInt1646 = 0xf423f;
- anInt1647 = 0xfff0bdc1;
- anInt1648 = 0xfffe7961;
- anInt1649 = 0x1869f;
- for (int j = 0; j < vertices; j++) {
- int x = vertexX[j];
- int y = vertexY[j];
- int z = vertexZ[j];
- if (x < anInt1646)
- anInt1646 = x;
- if (x > anInt1647)
- anInt1647 = x;
- if (z < anInt1649)
- anInt1649 = z;
- if (z > anInt1648)
- anInt1648 = z;
- if (-y > super.modelHeight)
- super.modelHeight = -y;
- if (y > anInt1651)
- anInt1651 = y;
- int j1 = x * x + z * z;
- if (j1 > anInt1650)
- anInt1650 = j1;
- }
- anInt1650 = (int) Math.sqrt(anInt1650);
- anInt1653 = (int) Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight);
- if (i != 21073) {
- return;
- } else {
- anInt1652 = anInt1653 + (int) Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651);
- return;
- }
- }
- public void skin() {
- if (vSkin != null) {
- int ai[] = new int[256];
- int j = 0;
- for (int l = 0; l < vertices; l++) {
- int j1 = vSkin[l];
- ai[j1]++;
- if (j1 > j)
- j = j1;
- }
- vertex_skin = new int[j + 1][];
- for (int k1 = 0; k1 <= j; k1++) {
- vertex_skin[k1] = new int[ai[k1]];
- ai[k1] = 0;
- }
- for (int j2 = 0; j2 < vertices; j2++) {
- int l2 = vSkin[j2];
- vertex_skin[l2][ai[l2]++] = j2;
- }
- vSkin = null;
- }
- if (tSkin != null) {
- int ai1[] = new int[256];
- int k = 0;
- for (int i1 = 0; i1 < faces; i1++) {
- int l1 = tSkin[i1];
- ai1[l1]++;
- if (l1 > k)
- k = l1;
- }
- face_skin = new int[k + 1][];
- for (int i2 = 0; i2 <= k; i2++) {
- face_skin[i2] = new int[ai1[i2]];
- ai1[i2] = 0;
- }
- for (int k2 = 0; k2 < faces; k2++) {
- int i3 = tSkin[k2];
- face_skin[i3][ai1[i3]++] = k2;
- }
- tSkin = null;
- }
- }
- public void method470(int frame, int nextFrame, int end, int cycle) {
- if (!Settings.toggle_tweening) {
- apply(frame);
- return;
- }
- if (vertex_skin != null && frame != -1) {
- Frame currentAnimation = Frame.method531(frame);
- FrameBase list1 = currentAnimation.aClass18_637;
- anInt1681 = 0;
- anInt1682 = 0;
- anInt1683 = 0;
- Frame nextAnimation = null;
- FrameBase list2 = null;
- if (nextFrame != -1) {
- nextAnimation = Frame.method531(nextFrame);
- if (nextAnimation.aClass18_637 != list1)
- nextAnimation = null;
- list2 = nextAnimation.aClass18_637;
- }
- if (nextAnimation == null || list2 == null) {
- for (int i_263_ = 0; i_263_ < currentAnimation.anInt638; i_263_++) {
- int i_264_ = currentAnimation.anIntArray639[i_263_];
- method472(list1.anIntArray342[i_264_], list1.anIntArrayArray343[i_264_],
- currentAnimation.anIntArray640[i_263_],
- currentAnimation.anIntArray641[i_263_],
- currentAnimation.anIntArray642[i_263_]);
- }
- } else {
- for (int i1 = 0; i1 < currentAnimation.anInt638; i1++) {
- int n1 = currentAnimation.anIntArray639[i1];
- int opcode = list1.anIntArray342[n1];
- int[] skin = list1.anIntArrayArray343[n1];
- int x = currentAnimation.anIntArray640[i1];
- int y = currentAnimation.anIntArray641[i1];
- int z = currentAnimation.anIntArray642[i1];
- boolean found = false;
- for (int i2 = 0; i2 < nextAnimation.anInt638; i2++) {
- int n2 = nextAnimation.anIntArray639[i2];
- if (list2.anIntArrayArray343[n2].equals(skin)) {
- if (opcode != 2) {
- x += (nextAnimation.anIntArray640[i2] - x) * cycle / end;
- y += (nextAnimation.anIntArray641[i2] - y) * cycle / end;
- z += (nextAnimation.anIntArray642[i2] - z) * cycle / end;
- } else {
- x &= 0x7ff;
- y &= 0x7ff;
- z &= 0x7ff;
- int dx = nextAnimation.anIntArray640[i2] - x & 0x7ff;
- int dy = nextAnimation.anIntArray641[i2] - y & 0x7ff;
- int dz = nextAnimation.anIntArray642[i2] - z & 0x7ff;
- if (dx >= 1024) {
- dx -= 2048;
- }
- if (dy >= 1024) {
- dy -= 2048;
- }
- if (dz >= 1024) {
- dz -= 2048;
- }
- x = x + dx * cycle / end & 0x7ff;
- y = y + dy * cycle / end & 0x7ff;
- z = z + dz * cycle / end & 0x7ff;
- }
- found = true;
- break;
- }
- }
- if (!found) {
- if (opcode != 3 && opcode != 2) {
- x = x * (end - cycle) / end;
- y = y * (end - cycle) / end;
- z = z * (end - cycle) / end;
- } else if (opcode == 3) {
- x = (x * (end - cycle) + (cycle << 7)) / end;
- y = (y * (end - cycle) + (cycle << 7)) / end;
- z = (z * (end - cycle) + (cycle << 7)) / end;
- } else {
- x &= 0x7ff;
- y &= 0x7ff;
- z &= 0x7ff;
- int dx = -x & 0x7ff;
- int dy = -y & 0x7ff;
- int dz = -z & 0x7ff;
- if (dx >= 1024) {
- dx -= 2048;
- }
- if (dy >= 1024) {
- dy -= 2048;
- }
- if (dz >= 1024) {//128
- dz -= 2048;//256
- }
- x = x + dx * cycle / end & 0x7ff;//0xff
- y = y + dy * cycle / end & 0x7ff;
- z = z + dz * cycle / end & 0x7ff;
- }
- }
- method472(opcode, skin, x, y, z);
- }
- }
- }
- }
- public void apply(int id) {
- if (vertex_skin == null)
- return;
- if (id == -1)
- return;
- Frame frame = Frame.method531(id);
- if (frame == null)
- return;
- FrameBase skin = frame.aClass18_637;
- anInt1681 = 0;
- anInt1682 = 0;
- anInt1683 = 0;
- for (int k = 0; k < frame.anInt638; k++) {
- int l = frame.anIntArray639[k];
- method472(skin.anIntArray342[l], skin.anIntArrayArray343[l], frame.anIntArray640[k], frame.anIntArray641[k], frame.anIntArray642[k]);
- }
- }
- public void method471(int label[], int idle, int current) {//interpolate
- if (current == -1)
- return;
- if (label == null || idle == -1) {
- apply(current);
- return;
- }
- Frame anim = Frame.method531(current);
- if (anim == null)
- return;
- Frame skin = Frame.method531(idle);
- if (skin == null) {
- apply(current);
- return;
- }
- FrameBase list = anim.aClass18_637;
- anInt1681 = 0;
- anInt1682 = 0;
- anInt1683 = 0;
- int id = 0;
- int table = label[id++];
- for (int index = 0; index < anim.anInt638; index++) {
- int condition;
- for (condition = anim.anIntArray639[index]; condition > table; table = label[id++])
- ;//empty
- if (condition != table || list.anIntArray342[condition] == 0)//opcode check
- method472(list.anIntArray342[condition], list.anIntArrayArray343[condition], anim.anIntArray640[index], anim.anIntArray641[index], anim.anIntArray642[index]);
- }
- anInt1681 = 0;
- anInt1682 = 0;
- anInt1683 = 0;
- id = 0;
- table = label[id++];
- for (int index = 0; index < skin.anInt638; index++) {
- int condition;
- for (condition = skin.anIntArray639[index]; condition > table; table = label[id++])
- ;//empty
- if (condition == table || list.anIntArray342[condition] == 0)//opcode check
- method472(list.anIntArray342[condition], list.anIntArrayArray343[condition], skin.anIntArray640[index], skin.anIntArray641[index], skin.anIntArray642[index]);
- }
- }
- private void method472(int opcode, int skin[], int x, int y, int z) {
- int length = skin.length;
- if (opcode == 0) {
- int j1 = 0;
- anInt1681 = 0;
- anInt1682 = 0;
- anInt1683 = 0;
- for (int index = 0; index < length; index++) {
- int l3 = skin[index];
- if (l3 < vertex_skin.length) {
- int ai5[] = vertex_skin[l3];
- for (int i5 = 0; i5 < ai5.length; i5++) {
- int j6 = ai5[i5];
- anInt1681 += vertexX[j6];
- anInt1682 += vertexY[j6];
- anInt1683 += vertexZ[j6];
- j1++;
- }
- }
- }
- if (j1 > 0) {
- anInt1681 = anInt1681 / j1 + x;
- anInt1682 = anInt1682 / j1 + y;
- anInt1683 = anInt1683 / j1 + z;
- return;
- } else {
- anInt1681 = x;
- anInt1682 = y;
- anInt1683 = z;
- return;
- }
- }
- if (opcode == 1) {
- for (int index = 0; index < length; index++) {
- int l2 = skin[index];
- if (l2 < vertex_skin.length) {
- int ai1[] = vertex_skin[l2];
- for (int i4 = 0; i4 < ai1.length; i4++) {
- int j5 = ai1[i4];
- vertexX[j5] += x;
- vertexY[j5] += y;
- vertexZ[j5] += z;
- }
- }
- }
- return;
- }
- if (opcode == 2) {//rotation
- for (int index = 0; index < length; index++) {
- int i3 = skin[index];
- if (i3 < vertex_skin.length) {
- int ai2[] = vertex_skin[i3];
- for (int j4 = 0; j4 < ai2.length; j4++) {
- int k5 = ai2[j4];
- vertexX[k5] -= anInt1681;
- vertexY[k5] -= anInt1682;
- vertexZ[k5] -= anInt1683;
- //int k6 = (x & 0xff) * 8;
- //int l6 = (y & 0xff) * 8;
- //int i7 = (z & 0xff) * 8;
- if(z != 0) {//if (i7 != 0) {
- int j7 = SINE[z];//i7
- int i8 = COSINE[z];//i7
- int l8 = vertexY[k5] * j7 + vertexX[k5] * i8 >> 16;
- vertexY[k5] = vertexY[k5] * i8 - vertexX[k5] * j7 >> 16;
- vertexX[k5] = l8;
- }
- if(x != 0) {//if (k6 != 0) {
- int k7 = SINE[x];//k6
- int j8 = COSINE[x];//k6
- int i9 = vertexY[k5] * j8 - vertexZ[k5] * k7 >> 16;
- vertexZ[k5] = vertexY[k5] * k7 + vertexZ[k5] * j8 >> 16;
- vertexY[k5] = i9;
- }
- if(y != 0) {//if (l6 != 0) {
- int l7 = SINE[y];//l6
- int k8 = COSINE[y];//l6
- int j9 = vertexZ[k5] * l7 + vertexX[k5] * k8 >> 16;
- vertexZ[k5] = vertexZ[k5] * k8 - vertexX[k5] * l7 >> 16;
- vertexX[k5] = j9;
- }
- vertexX[k5] += anInt1681;
- vertexY[k5] += anInt1682;
- vertexZ[k5] += anInt1683;
- }
- }
- }
- return;
- }
- if (opcode == 3) {
- for (int index = 0; index < length; index++) {
- int j3 = skin[index];
- if (j3 < vertex_skin.length) {
- int ai3[] = vertex_skin[j3];
- for (int k4 = 0; k4 < ai3.length; k4++) {
- int l5 = ai3[k4];
- vertexX[l5] -= anInt1681;
- vertexY[l5] -= anInt1682;
- vertexZ[l5] -= anInt1683;
- vertexX[l5] = (vertexX[l5] * x) / 128;
- vertexY[l5] = (vertexY[l5] * y) / 128;
- vertexZ[l5] = (vertexZ[l5] * z) / 128;
- vertexX[l5] += anInt1681;
- vertexY[l5] += anInt1682;
- vertexZ[l5] += anInt1683;
- }
- }
- }
- return;
- }
- if (opcode == 5 && face_skin != null && alpha != null) {
- for (int index = 0; index < length; index++) {
- int k3 = skin[index];
- if (k3 < face_skin.length) {
- int ai4[] = face_skin[k3];
- for (int l4 = 0; l4 < ai4.length; l4++) {
- int i6 = ai4[l4];
- alpha[i6] += x * 8;
- if (alpha[i6] < 0)
- alpha[i6] = 0;
- if (alpha[i6] > 255)
- alpha[i6] = 255;
- }
- }
- }
- }
- }
- public void method473() {
- for (int point = 0; point < vertices; point++) {
- int k = vertexX[point];
- vertexX[point] = vertexZ[point];
- vertexZ[point] = -k;
- }
- }
- public void method474(int i) {
- int k = SINE[i];
- int l = COSINE[i];
- for (int point = 0; point < vertices; point++) {
- int j1 = vertexY[point] * l - vertexZ[point] * k >> 16;
- vertexZ[point] = vertexY[point] * k + vertexZ[point] * l >> 16;
- vertexY[point] = j1;
- }
- }
- public void translate(int x, int y, int z) {
- for (int point = 0; point < vertices; point++) {
- vertexX[point] += x;
- vertexY[point] += y;
- vertexZ[point] += z;
- }
- }
- public void recolor(int found, int replace) {
- if(color != null) {
- for (int face = 0; face < faces; face++) {
- if (color[face] == (short) found)
- color[face] = (short) replace;
- }
- }
- }
- public void retexture(short found, short replace) {
- if(texture != null)
- for (int face = 0; face < faces; face++) {
- if (texture[face] == found) {
- texture[face] = replace;
- }
- }
- }
- public void color_to_texture(int found, short tex) {
- texture_faces = faces;
- int set_type = 0;
- if(render_type == null) {
- render_type = new int[faces];
- }
- if(color == null) {
- color = new short[faces];
- }
- if(color[faces] == -2) {
- texture_edge_a = new short[faces];
- texture_edge_b = new short[faces];
- texture_edge_c = new short[faces];
- for(int index = 0; index < faces; index++) {
- if(color[index] != 0) {
- color[index] = tex;
- render_type[index] = 3 + set_type;
- set_type += 4;
- texture_edge_a[index] = (short) edge_a[index];
- texture_edge_b[index] = (short) edge_b[index];
- texture_edge_c[index] = (short) edge_c[index];
- }
- }
- }
- }
- public void method477() {
- for (int index = 0; index < vertices; index++)
- vertexZ[index] = -vertexZ[index];
- for (int face = 0; face < faces; face++) {
- int l = edge_a[face];
- edge_a[face] = edge_c[face];
- edge_c[face] = l;
- }
- }
- public void scale() {//fix 600+ model scaling
- for (int index = 0; index < vertices; index++) {
- vertexX[index] >>= 2;
- vertexY[index] >>= 2;
- vertexZ[index] >>= 2;
- }
- }
- public void scale(int i, int j, int l) {//478
- for (int index = 0; index < vertices; index++) {
- vertexX[index] = (vertexX[index] * i) / 128;
- vertexY[index] = (vertexY[index] * l) / 128;
- vertexZ[index] = (vertexZ[index] * j) / 128;
- }
- }
- public void light(int intensity, int mag, int x, int y, int z, boolean flat_shading) {
- light(intensity, mag, x, y, z, flat_shading, false);
- }
- public void light(int intensity, int mag, int x, int y, int z, boolean flat_shading, boolean player) {
- int pre_mag = (int) Math.sqrt(x * x + y * y + z * z);
- int fall_off = mag * pre_mag >> 8;
- hue_a = new int[faces];
- hue_b = new int[faces];
- hue_c = new int[faces];
- if (super.aClass33Array1425 == null) {
- super.aClass33Array1425 = new Vertex[vertices];
- for (int index = 0; index < vertices; index++)
- super.aClass33Array1425[index] = new Vertex();
- }
- for (int face = 0; face < faces; face++) {
- int j2 = edge_a[face];
- int l2 = edge_b[face];
- int i3 = edge_c[face];
- int j3 = vertexX[l2] - vertexX[j2];
- int k3 = vertexY[l2] - vertexY[j2];
- int l3 = vertexZ[l2] - vertexZ[j2];
- int i4 = vertexX[i3] - vertexX[j2];
- int j4 = vertexY[i3] - vertexY[j2];
- int k4 = vertexZ[i3] - vertexZ[j2];
- int l4 = k3 * k4 - j4 * l3;
- int i5 = l3 * i4 - k4 * j3;
- int j5;
- for (j5 = j3 * j4 - i4 * k3; l4 > 8192 || i5 > 8192 || j5 > 8192 || l4 < -8192 || i5 < -8192 || j5 < -8192; j5 >>= 1) {
- l4 >>= 1;
- i5 >>= 1;
- }
- int k5 = (int) Math.sqrt(l4 * l4 + i5 * i5 + j5 * j5);
- if (k5 <= 0)
- k5 = 1;
- l4 = (l4 * 256) / k5;
- i5 = (i5 * 256) / k5;
- j5 = (j5 * 256) / k5;
- int type;
- if(render_type == null)
- type = 0;
- else
- type = render_type[face];
- int transparent;
- if(alpha == null)
- transparent = 0;
- else
- transparent = alpha[face];
- short texture_id;
- if(texture == null)
- texture_id = -1;
- else
- texture_id = texture[face];
- if(transparent == -2) {
- type = 3;
- }
- if(transparent == -1) {
- type = 2;
- }
- if (render_type == null || (render_type[face] & 1) == 0) {
- Vertex class33_2 = super.aClass33Array1425[j2];
- class33_2.anInt602 += l4;
- class33_2.anInt603 += i5;
- class33_2.anInt604 += j5;
- class33_2.anInt605++;
- class33_2 = super.aClass33Array1425[l2];
- class33_2.anInt602 += l4;
- class33_2.anInt603 += i5;
- class33_2.anInt604 += j5;
- class33_2.anInt605++;
- class33_2 = super.aClass33Array1425[i3];
- class33_2.anInt602 += l4;
- class33_2.anInt603 += i5;
- class33_2.anInt604 += j5;
- class33_2.anInt605++;
- } else {
- int light = intensity + (x * l4 + y * i5 + z * j5) / (fall_off + fall_off / 2);
- if(texture_id != -1) {
- if(type == 1) {
- hue_a[face] = method481(light);
- hue_c[face] = -1;
- } else {
- hue_c[face] = -2;
- }
- } else {
- if(type != 0) {
- if(type == 1) {
- hue_a[face] = method481(color[face] & 0xffff, light);
- hue_c[face] = -1;
- } else if(type == 3) {
- hue_a[face] = 128;
- hue_c[face] = -1;
- } else {
- hue_a[face] = method481(color[face] & 0xffff, light);
- hue_c[face] = -1;
- }
- } else {
- hue_a[face] = method481(color[face] & 0xffff, light);
- hue_c[face] = -1;
- }
- }
- }
- }
- if (flat_shading) {
- method480(intensity, fall_off, x, y, z, player);
- } else {
- gouraud_vertex = new Vertex[vertices];
- for (int point = 0; point < vertices; point++) {
- Vertex class33 = super.aClass33Array1425[point];
- Vertex class33_1 = gouraud_vertex[point] = new Vertex();
- class33_1.anInt602 = class33.anInt602;
- class33_1.anInt603 = class33.anInt603;
- class33_1.anInt604 = class33.anInt604;
- class33_1.anInt605 = class33.anInt605;
- }
- }
- if (flat_shading) {
- method466();
- return;
- } else {
- method468(21073);
- return;
- }
- }
- public final void method480(int intensity, int fall_off, int x, int y, int z) {
- method480(intensity, fall_off, x, y, z, false);
- }
- public final void method480(int intensity, int fall_off, int x, int y, int z, boolean player) {
- for (int face = 0; face < faces; face++) {
- int a = edge_a[face];
- int b = edge_b[face];
- int c = edge_c[face];
- short texture_id;
- if(texture == null) {
- texture_id = -1;
- } else {
- texture_id = texture[face];
- if(player) {
- //These checks are all important! - black triangle check
- if(alpha != null && color != null) {
- if(color[face] == 0 && render_priorities[face] == 0) {
- if(render_type[face] == 2 && texture[face] == -1) {
- alpha[face] = 255;
- }
- }
- } else if(alpha == null) {
- if(color[face] == 0 && render_priorities[face] == 0) {
- if(texture[face] == -1) {
- alpha = new int[faces];
- if(render_type[face] == 2) {
- alpha[face] = 255;
- }
- }
- }
- }
- }
- }
- if (render_type == null) {
- int hsl = color[face] & '\uffff';
- Vertex vertex = super.aClass33Array1425[a];
- int light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
- hue_a[face] = method481(hsl, light, 0);
- vertex = super.aClass33Array1425[b];
- light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
- hue_b[face] = method481(hsl, light, 0);
- vertex = super.aClass33Array1425[c];
- light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
- hue_c[face] = method481(hsl, light, 0);
- } else if ((render_type[face] & 1) == 0) {
- int type = render_type[face];
- int hsl = color[face] & '\uffff';
- Vertex vertex = super.aClass33Array1425[a];
- int light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
- hue_a[face] = method481(hsl, light, type);
- vertex = super.aClass33Array1425[b];
- light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
- hue_b[face] = method481(hsl, light, type);
- vertex = super.aClass33Array1425[c];
- light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
- hue_c[face] = method481(hsl, light, type);
- }
- }
- super.aClass33Array1425 = null;
- gouraud_vertex = null;
- vSkin = null;
- tSkin = null;
- if (render_type != null) {
- for (int face = 0; face < faces; face++)
- if ((render_type[face] & 2) == 2)
- return;
- }
- color = null;
- }
- public static final int method481(int light) {
- if(light >= 2) {
- if(light > 126) {
- light = 126;
- }
- } else {
- light = 2;
- }
- return light;
- }
- public static final int method481(int hsl, int light) {
- light = light * (hsl & 127) >> 7;
- if(light < 2) {
- light = 2;
- } else if(light > 126) {
- light = 126;
- }
- return (hsl & '\uff80') + light;
- }
- public static final int method481(int hsl, int light, int type) {
- if ((type & 2) == 2)
- return method481(light);
- return method481(hsl, light);
- }
- //inventory / widget model rendering
- public final void method482(int roll, int yaw, int pitch, int start_x, int start_y, int zoom) {
- int depth = 0;
- int center_x = Rasterizer.textureInt1;
- int center_y = Rasterizer.textureInt2;
- int depth_sin = SINE[depth];
- int depth_cos = COSINE[depth];
- int roll_sin = SINE[roll];
- int roll_cos = COSINE[roll];
- int yaw_sin = SINE[yaw];
- int yaw_cos = COSINE[yaw];
- int pitch_sin = SINE[pitch];
- int pitch_cos = COSINE[pitch];
- int position = start_y * pitch_sin + zoom * pitch_cos >> 16;
- for (int index = 0; index < vertices; index++) {
- int x = vertexX[index];
- int y = vertexY[index];
- int z = vertexZ[index];
- if (yaw != 0) {
- int k5 = y * yaw_sin + x * yaw_cos >> 16;
- y = y * yaw_cos - x * yaw_sin >> 16;
- x = k5;
- }
- if (depth != 0) {
- int l5 = y * depth_cos - z * depth_sin >> 16;
- z = y * depth_sin + z * depth_cos >> 16;
- y = l5;
- }
- if (roll != 0) {
- int i6 = z * roll_sin + x * roll_cos >> 16;
- z = z * roll_cos - x * roll_sin >> 16;
- x = i6;
- }
- x += start_x;
- y += start_y;
- z += zoom;
- int j6 = y * pitch_cos - z * pitch_sin >> 16;
- z = y * pitch_sin + z * pitch_cos >> 16;
- y = j6;
- anIntArray1667[index] = z - position;
- vertex_viewpoint_z[index] = z;//was set to 0, changed to z?
- vertex_viewpoint_x[index] = center_x + (x << 9) / z;
- vertex_viewpoint_y[index] = center_y + (y << 9) / z;
- if (texture_faces > 0) {
- texture_viewpoint_x[index] = x;
- texture_viewpoint_y[index] = y;
- texture_viewpoint_z[index] = z;
- }
- }
- try {
- method483(false, false, false, 0, anInt1653, 0, -1, -1, -1, null);
- return;
- } catch (Exception _ex) {
- return;
- }
- }
- //Scene models
- @Override
- public final void method443(int orientation, int object_cosine_y, int object_sine_y, int object_sine_x, int object_cosine_x, int start_x, int start_y, int depth, long uid, ParticleEngine class108_sub2) {
- this.method2593(orientation);
- int j2 = depth * object_cosine_x - start_x * object_sine_x >> 16;
- int k2 = start_y * object_cosine_y + j2 * object_sine_y >> 16;
- int l2 = anInt1650 * object_sine_y >> 16;
- int i3 = k2 + l2;
- if (i3 <= 50 || k2 >= 3500)
- return;
- int j3 = depth * object_sine_x + start_x * object_cosine_x >> 16;
- int k3 = j3 - anInt1650 << SceneGraph.viewDistance;
- if (k3 / i3 >= Raster.center_y)
- return;
- int l3 = j3 + anInt1650 << SceneGraph.viewDistance;
- if (l3 / i3 <= -Raster.center_y)
- return;
- int i4 = start_y * object_sine_y - j2 * object_cosine_y >> 16;
- int j4 = anInt1650 * object_cosine_y >> 16;
- int k4 = i4 + j4 << SceneGraph.viewDistance;
- if (k4 / i3 <= -Raster.viewport_center_x)
- return;
- int l4 = j4 + (super.modelHeight * object_sine_y >> 16);
- int i5 = i4 - l4 << SceneGraph.viewDistance;
- if (i5 / i3 >= Raster.viewport_center_x)
- return;
- int j5 = l2 + (super.modelHeight * object_cosine_y >> 16);
- boolean in_viewable_raster = false;//wrong
- if (k2 - j5 <= 50)
- in_viewable_raster = true;
- boolean large_object = false;
- if(class108_sub2 != null) {
- }
- int x;
- int width;
- int y;
- int height;
- int color;
- int mouse_x;
- int mouse_y;
- if ((CubeList.draw_rect || CubeList.draw_cube) && uid > 0) {
- int var39 = k2 - l2;
- if (var39 <= 50) {
- var39 = 50;
- }
- if (j3 > 0) {
- x = k3 / i3;
- width = l3 / var39;
- } else {
- width = l3 / i3;
- x = k3 / var39;
- }
- if (i4 > 0) {
- y = i5 / i3;
- height = k4 / var39;
- } else {
- height = k4 / i3;
- y = i5 / var39;
- }
- color = (CubeList.draw_rect ? -8355840 : -16776961);
- mouse_x = anInt1685 - Rasterizer.textureInt1;
- mouse_y = anInt1686 - Rasterizer.textureInt2;
- if (mouse_x > x && mouse_x < width && mouse_y > y && mouse_y < height) {
- color = (CubeList.draw_rect ? -256 : -65281);
- }
- if(CubeList.draw_rect)
- RectangleNode.add(x + Rasterizer.textureInt1, y + Rasterizer.textureInt2, width + Rasterizer.textureInt1, height + Rasterizer.textureInt2, color);
- if(CubeList.draw_cube) {
- CubeNode.add(this, start_x, start_y, depth, color);
- }
- }
- if (uid > 0 && objectExists) {
- int k5 = k2 - l2;
- if (k5 <= 50)
- k5 = 50;
- if (j3 > 0) {
- k3 /= i3;
- l3 /= k5;
- } else {
- l3 /= i3;
- k3 /= k5;
- }
- if (i4 > 0) {
- i5 /= i3;
- k4 /= k5;
- } else {
- k4 /= i3;
- i5 /= k5;
- }
- int i6 = anInt1685 - Rasterizer.textureInt1;
- int k6 = anInt1686 - Rasterizer.textureInt2;
- if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) {
- if (fits_on_single_square) {
- objectsInCurrentRegion[anInt1687++] = uid;
- } else {
- large_object = true;
- }
- }
- }
- int center_x = Rasterizer.textureInt1;
- int center_y = Rasterizer.textureInt2;
- int sine_x = 0;
- int cosine_x = 0;
- if (orientation != 0) {
- sine_x = SINE[orientation];
- cosine_x = COSINE[orientation];
- }
- for (int index = 0; index < vertices; index++) {
- int raster_x = vertexX[index];
- int raster_y = vertexY[index];
- int raster_z = vertexZ[index];
- if (orientation != 0) {
- int rotated_x = raster_z * sine_x + raster_x * cosine_x >> 16;
- raster_z = raster_z * cosine_x - raster_x * sine_x >> 16;
- raster_x = rotated_x;
- }
- raster_x += start_x;
- raster_y += start_y;
- raster_z += depth;
- int position = raster_z * object_sine_x + raster_x * object_cosine_x >> 16;
- raster_z = raster_z * object_cosine_x - raster_x * object_sine_x >> 16;
- raster_x = position;
- position = raster_y * object_sine_y - raster_z * object_cosine_y >> 16;
- raster_z = raster_y * object_cosine_y + raster_z * object_sine_y >> 16;
- raster_y = position;
- anIntArray1667[index] = raster_z - k2;
- vertex_viewpoint_z[index] = raster_z;
- if (raster_z >= 50) {
- vertex_viewpoint_x[index] = center_x + (raster_x << SceneGraph.viewDistance) / raster_z;
- vertex_viewpoint_y[index] = center_y + (raster_y << SceneGraph.viewDistance) / raster_z;
- } else {
- vertex_viewpoint_x[index] = -5000;
- in_viewable_raster = true;
- }
- if (in_viewable_raster || texture_faces > 0) {
- texture_viewpoint_x[index] = raster_x;
- texture_viewpoint_y[index] = raster_y;
- texture_viewpoint_z[index] = raster_z;
- }
- }
- if (class108_sub2 != null) {
- final int i_147_ = ParticleEngine.offsetX + center_x;
- final int i_148_ = ParticleEngine.offsetY + center_y;
- for (int i_149_ = 0; i_149_ < class108_sub2.aClass108_Sub3_Sub1Array2355.length; i_149_++) {
- final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_149_];
- if (class108_sub3_sub1 != null && !class108_sub3_sub1.aBoolean3097) {
- int i_150_ = (class108_sub3_sub1.position_x >> 12) - Client.instance.absoluteX;
- int i_151_ = (class108_sub3_sub1.position_y >> 12) - Client.instance.anchor;
- int i_152_ = (class108_sub3_sub1.position_z >> 12) - Client.instance.absoluteY;
- int i_153_ = i_152_ * object_sine_x + i_150_ * object_cosine_x >> 16;
- i_152_ = i_152_ * object_cosine_x - i_150_ * object_sine_x >> 16;
- i_150_ = i_153_;
- i_153_ = i_151_ * object_sine_y - i_152_ * object_cosine_y >> 16;
- i_152_ = i_151_ * object_cosine_y + i_152_ * object_sine_y >> 16;
- i_151_ = i_153_;
- if (i_152_ >= 50) {
- anIntArray3812[i_149_] = i_147_ + (i_150_ << 9) / i_152_;
- anIntArray3806[i_149_] = i_148_ + (i_151_ << 9) / i_152_;
- anIntArray3834[i_149_] = i_152_;
- anIntArray3821[i_149_] = i_152_ - k2;
- } else {
- anIntArray3821[i_149_] = -2147483648;
- }
- } else {
- anIntArray3821[i_149_] = -2147483648;
- }
- }
- }
- try {
- method483(in_viewable_raster, large_object, fits_on_single_square, uid, k2 - j5, orientation, start_x, start_y, depth, class108_sub2);
- return;
- } catch (Exception _ex) {
- return;
- }
- }
- private final void method483(boolean in_viewable_raster, boolean large_object, boolean loaded, long uid, int i, int orientation, int start_x, int start_y, int depth, final ParticleEngine class108_sub2) {
- int i_11_ = 0;
- int i_12_ = 0;
- if (!aBoolean3833) {
- for (int j = 0; j < anInt1652; j++) {
- anIntArray1671[j] = 0;
- }
- for(int k = 0; k < 32; k++) {
- anIntArray3815[k] = 0;
- }
- anInt3814 = 0;
- }
- int var5 = loaded ? 20 : 5;
- if(CubeList.draw_vertices && large_object) {
- RectangleNode.method4817(this, var5);
- }
- for (int face = 0; face < faces; face++) {
- if (render_type == null || render_type[face] != -1) {
- int a = edge_a[face];
- int b = edge_b[face];
- int c = edge_c[face];
- int x_a = vertex_viewpoint_x[a];
- int x_b = vertex_viewpoint_x[b];
- int x_c = vertex_viewpoint_x[c];
- if (in_viewable_raster && (x_a == -5000 || x_b == -5000 || x_c == -5000)) {
- scale_textures[face] = true;
- int j5 = (anIntArray1667[a] + anIntArray1667[b] + anIntArray1667[c]) / 3 + anInt1653;
- if(anIntArray1671[j5] < 64) {
- anIntArrayArray1672[j5][anIntArray1671[j5]++] = face;
- } else {
- int i_35_ = anIntArray1671[j5];
- if (i_35_ == 64) {
- if (anInt3814 == 512) {
- continue;
- }
- anIntArray1671[j5] = i_35_ = 65 + anInt3814++;
- }
- i_35_ -= 65;
- anIntArrayArray3809[i_35_][anIntArray3815[i_35_]++] = face;
- }
- } else {
- if (large_object && method486(anInt1685, anInt1686, vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c], x_a, x_b, x_c)) {
- objectsInCurrentRegion[anInt1687++] = uid;
- large_object = false;
- }
- if ((x_a - x_b) * (vertex_viewpoint_y[c] - vertex_viewpoint_y[b]) - (vertex_viewpoint_y[a] - vertex_viewpoint_y[b]) * (x_c - x_b) > 0) {
- scale_textures[face] = false;
- if (x_a < 0 || x_b < 0 || x_c < 0 || x_a > Raster.center_x || x_b > Raster.center_x || x_c > Raster.center_x)
- aBooleanArray1663[face] = true;
- else
- aBooleanArray1663[face] = false;
- int k5 = (anIntArray1667[a] + anIntArray1667[b] + anIntArray1667[c]) / 3 + anInt1653;
- if(anIntArray1671[k5] < 64) {
- anIntArrayArray1672[k5][anIntArray1671[k5]++] = face;
- } else {
- int k6 = anIntArray1671[k5];
- if(k6 == 64) {
- if(anInt3814 == 512)
- continue;
- anIntArray1671[face] = k6 = 65 + anInt3814++;
- }
- k6 -= 65;
- anIntArrayArray3809[k6][anIntArray3815[k6]++] = face;
- }
- }
- }
- }
- }
- if (class108_sub2 != null && !aBoolean3833) {
- int i_38_ = 0;
- for (/**/; i_38_ < anIntArray3821.length; i_38_++) {
- final int i_39_ = anIntArray3821[i_38_] + i;
- if (i_39_ >= 0 && i_39_ < 1600) {
- if (anIntArray1671[i_39_] < 64) {
- anIntArrayArray1672[i_39_][anIntArray1671[i_39_]++] = i_38_ + 1 << 16;
- } else {
- int i_40_ = anIntArray1671[i_39_];
- if (i_40_ == 64) {
- if (anInt3814 == 512) {
- continue;
- }
- anIntArray1671[i_39_] = i_40_ = 65 + anInt3814++;
- }
- i_40_ -= 65;
- anIntArrayArray3809[i_40_][anIntArray3815[i_40_]++] = i_38_ + 1 << 16;
- }
- }
- }
- }
- if (render_priorities == null) {
- for (int i1 = anInt1652 - 1; i1 >= 0; i1--) {
- int l1 = anIntArray1671[i1];
- if (l1 > 0) {
- final int i_50_ = l1 > 64 ? 64 : l1;
- int ai[] = anIntArrayArray1672[i1];
- for (int j3 = 0; j3 < i_50_; j3++) {
- final int i_52_ = ai[j3];
- if(i_52_ < 65536) {
- render_textures(ai[j3]);
- } else {
- final int i_53_ = (i_52_ >> 16) - 1;
- final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_53_];
- int i_54_ = anIntArray3834[i_53_] * 400;
- if (i_54_ == 0) {
- i_54_ = 1;
- }
- Raster.drawAlphaCircle(anIntArray3812[i_53_], anIntArray3806[i_53_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_54_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
- }
- }
- }
- if (l1 > 64) {
- final int i_55_ = anIntArray1671[i1] - 64 - 1;
- int ai[] = anIntArrayArray3809[i_55_];
- for (int j3 = 0; j3 < anIntArray3815[i_55_]; j3++) {
- final int i_57_ = ai[j3];
- if(i_57_ < 65536)
- render_textures(ai[j3]);
- else {
- final int i_58_ = (i_57_ >> 16) - 1;
- final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_58_];
- int i_59_ = anIntArray3834[i_58_] * 400;
- if (i_59_ == 0) {
- i_59_ = 1;
- }
- Raster.drawAlphaCircle(anIntArray3812[i_58_], anIntArray3806[i_58_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_59_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
- }
- }
- }
- }
- return;
- }
- for (int j1 = 0; j1 < 12; j1++) {
- anIntArray1673[j1] = 0;
- anIntArray1677[j1] = 0;
- }
- for (int i2 = anInt1652 - 1; i2 >= 0; i2--) {
- int k2 = anIntArray1671[i2];
- if (k2 > 0) {
- int i_63_;
- if (k2 > 64) {
- i_63_ = 64;
- } else {
- i_63_ = k2;
- }
- int ai1[] = anIntArrayArray1672[i2];
- for (int i4 = 0; i4 < i_63_; i4++) {
- int l4 = ai1[i4];
- if(l4 < 65536) {
- byte l5 = render_priorities[l4];
- int j6 = anIntArray1673[l5]++;
- anIntArrayArray1674[l5][j6] = l4;
- if (l5 < 10)
- anIntArray1677[l5] += i2;
- else if (l5 == 10)
- anIntArray1675[j6] = i2;
- else
- anIntArray1676[j6] = i2;
- } else {
- anIntArray3818[i_12_++] = (l4 >> 16) - 1;
- }
- }
- }
- if(k2 > 64) {
- final int i_68_ = anIntArray1671[i2] - 64 - 1;
- final int[] is = anIntArrayArray3809[i_68_];
- for (int i_69_ = 0; i_69_ < anIntArray3815[i_68_]; i_69_++) {
- final int i_70_ = is[i_69_];
- if (i_70_ < 65536) {
- final byte i_71_ = render_priorities[i_70_];
- final int i_72_ = anIntArray1673[i_71_]++;
- anIntArrayArray1674[i_71_][i_72_] = i_70_;
- if (i_71_ < 10) {
- anIntArray1677[i_71_] += i2;
- } else if (i_71_ == 10) {
- anIntArray1675[i_72_] = i2;
- } else {
- anIntArray1676[i_72_] = i2;
- }
- } else {
- anIntArray3818[i_12_++] = (i_70_ >> 16) - 1;
- }
- }
- }
- }
- int l2 = 0;
- if (anIntArray1673[1] > 0 || anIntArray1673[2] > 0)
- l2 = (anIntArray1677[1] + anIntArray1677[2]) / (anIntArray1673[1] + anIntArray1673[2]);
- int k3 = 0;
- if (anIntArray1673[3] > 0 || anIntArray1673[4] > 0)
- k3 = (anIntArray1677[3] + anIntArray1677[4]) / (anIntArray1673[3] + anIntArray1673[4]);
- int j4 = 0;
- if (anIntArray1673[6] > 0 || anIntArray1673[8] > 0)
- j4 = (anIntArray1677[6] + anIntArray1677[8]) / (anIntArray1673[6] + anIntArray1673[8]);
- int i6 = 0;
- int k6 = anIntArray1673[10];
- int ai2[] = anIntArrayArray1674[10];
- int ai3[] = anIntArray1675;
- int i_79_ = 0;
- if (i6 == k6) {
- i6 = 0;
- k6 = anIntArray1673[11];
- ai2 = anIntArrayArray1674[11];
- ai3 = anIntArray1676;
- }
- int i5;
- if (i6 < k6)
- i5 = ai3[i6];
- else
- i5 = -1000;
- for (int l6 = 0; l6 < 10; l6++) {
- while (l6 == 0 && i5 > l2) {
- render_textures(ai2[i6++]);
- if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
- i6 = 0;
- k6 = anIntArray1673[11];
- ai2 = anIntArrayArray1674[11];
- ai3 = anIntArray1676;
- }
- if (i6 < k6)
- i5 = ai3[i6];
- else
- i5 = -1000;
- }
- while (l6 == 3 && i5 > k3) {
- render_textures(ai2[i6++]);
- if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
- i6 = 0;
- k6 = anIntArray1673[11];
- ai2 = anIntArrayArray1674[11];
- ai3 = anIntArray1676;
- }
- if (i6 < k6)
- i5 = ai3[i6];
- else
- i5 = -1000;
- }
- while (l6 == 5 && i5 > j4) {
- render_textures(ai2[i6++]);
- if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
- i6 = 0;
- k6 = anIntArray1673[11];
- ai2 = anIntArrayArray1674[11];
- ai3 = anIntArray1676;
- }
- if (i6 < k6)
- i5 = ai3[i6];
- else
- i5 = -1000;
- }
- int i7 = anIntArray1673[l6];
- int ai4[] = anIntArrayArray1674[l6];
- if(class108_sub2 != null) {
- int i_84_ = 2147483647;
- if (i7 != 0) {
- i_84_ = anIntArray1677[l6] / i7;
- }
- for (int i_85_ = anIntArray3818[i_79_]; anIntArray3821[i_85_] + i > i_84_; i_85_ = anIntArray3818[i_79_++]) {
- final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_85_];
- int i_86_ = anIntArray3834[i_85_] * 400;
- if (i_86_ == 0) {
- i_86_ = 1;
- }
- Raster.drawAlphaCircle(anIntArray3812[i_85_], anIntArray3806[i_85_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_86_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
- if (i_79_ >= i_12_) {
- break;
- }
- }
- }
- for (int j7 = 0; j7 < i7; j7++)
- render_textures(ai4[j7]);
- }
- while (i5 != -1000) {
- render_textures(ai2[i6++]);
- if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
- i6 = 0;
- ai2 = anIntArrayArray1674[11];
- k6 = anIntArray1673[11];
- ai3 = anIntArray1676;
- }
- if (i6 < k6)
- i5 = ai3[i6];
- else
- i5 = -1000;
- }
- if (class108_sub2 != null) {
- int i_88_ = anIntArray3818[i_79_];
- while (i_79_ < i_12_) {
- final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_88_];
- int i_89_ = anIntArray3834[i_88_] * 400;
- if (i_89_ == 0) {
- i_89_ = 1;
- }
- Raster.drawAlphaCircle(anIntArray3812[i_88_], anIntArray3806[i_88_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_89_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
- i_88_ = anIntArray3818[i_79_++];
- }
- }
- /*int sine = 0;
- int cosine = 0;
- if(orientation != 0) {
- sine = SINE[orientation];
- cosine = COSINE[orientation];
- }
- for(int point = 0; point < vertices; point++) {
- int particle_id = particle_vertices[point] - 1;
- if(particle_id < 0)
- continue;
- ParticleDefinition def = ParticleDefinition.cache[particle_id];
- int raster_x = vertexX[point];
- int raster_y = vertexY[point];
- int raster_z = vertexZ[point];
- int buffer = vertex_viewpoint_z[point];
- if(orientation != 0) {
- int rotated_offset = raster_z * sine + raster_x * cosine >> 16;
- raster_z = raster_z * cosine - raster_x * sine >> 16;
- raster_x = rotated_offset;
- }
- raster_x += (start_x + Client.instance.absoluteX);
- //raster_y += (start_y + Client.instance.anchor);
- raster_z += (depth + Client.instance.absoluteY);
- Vector pos = new Vector(raster_x, -raster_y, raster_z);
- for(int alive = 0; alive < def.getSpawnRate(); alive++) {
- Particle particle = new Particle(def, pos, buffer, particle_id);
- Client.instance.addParticle(particle);
- }
- }*/
- }
- private final void render_textures(int face) {
- if (scale_textures[face]) {
- render_viewport_textures(face);
- return;
- }
- int a = edge_a[face];
- int b = edge_b[face];
- int c = edge_c[face];
- Rasterizer.aBoolean1462 = aBooleanArray1663[face];
- if (alpha == null)
- Rasterizer.anInt1465 = 0;
- else
- Rasterizer.anInt1465 = alpha[face] & 0xff;
- int type;
- if (render_type == null)
- type = 0;
- else
- type = render_type[face] & 3;
- if(texture != null && texture[face] != -1) {
- int texture_a = a;
- int texture_b = b;
- int texture_c = c;
- if(texture_coordinates != null && texture_coordinates[face] != -1) {
- int coordinate = texture_coordinates[face] & 0xff;
- texture_a = texture_edge_a[coordinate];
- texture_b = texture_edge_b[coordinate];
- texture_c = texture_edge_c[coordinate];
- }
- if(hue_c[face] == -1) {
- Rasterizer.drawTexturedTriangle(
- vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
- vertex_viewpoint_x[a], vertex_viewpoint_x[b], vertex_viewpoint_x[c],
- hue_a[face], hue_a[face], hue_a[face],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- } else {
- Rasterizer.drawTexturedTriangle(
- vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
- vertex_viewpoint_x[a], vertex_viewpoint_x[b],vertex_viewpoint_x[c],
- hue_a[face], hue_b[face], hue_c[face],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- }
- } else if(hue_c[face] == -1) {
- Rasterizer.drawFlatTriangle1(
- vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
- vertex_viewpoint_x[a], vertex_viewpoint_x[b], vertex_viewpoint_x[c],
- modelIntArray3[hue_a[face]],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- } else {
- if (type == 0) {
- Rasterizer.drawShadedTriangle(
- vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
- vertex_viewpoint_x[a], vertex_viewpoint_x[b], vertex_viewpoint_x[c],
- hue_a[face], hue_b[face], hue_c[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- }
- }
- }
- private final void render_viewport_textures(int face) {
- int center_x = Rasterizer.textureInt1;
- int center_y = Rasterizer.textureInt2;
- int l = 0;
- int a = edge_a[face];
- int b = edge_b[face];
- int c = edge_c[face];
- int l1 = texture_viewpoint_z[a];
- int i2 = texture_viewpoint_z[b];
- int j2 = texture_viewpoint_z[c];
- if (l1 >= 50) {
- anIntArray1678[l] = vertex_viewpoint_x[a];
- anIntArray1679[l] = vertex_viewpoint_y[a];
- anIntArray1680[l++] = hue_a[face];
- } else {
- int k2 = texture_viewpoint_x[a];
- int k3 = texture_viewpoint_y[a];
- int k4 = hue_a[face];
- if (j2 >= 50) {
- int k5 = (50 - l1) * modelIntArray4[j2 - l1];
- anIntArray1678[l] = center_x + (k2 + ((texture_viewpoint_x[c] - k2) * k5 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1679[l] = center_y + (k3 + ((texture_viewpoint_y[c] - k3) * k5 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1680[l++] = k4 + ((hue_c[face] - k4) * k5 >> 16);
- }
- if (i2 >= 50) {
- int l5 = (50 - l1) * modelIntArray4[i2 - l1];
- anIntArray1678[l] = center_x + (k2 + ((texture_viewpoint_x[b] - k2) * l5 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1679[l] = center_y + (k3 + ((texture_viewpoint_y[b] - k3) * l5 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1680[l++] = k4 + ((hue_b[face] - k4) * l5 >> 16);
- }
- }
- if (i2 >= 50) {
- anIntArray1678[l] = vertex_viewpoint_x[b];
- anIntArray1679[l] = vertex_viewpoint_y[b];
- anIntArray1680[l++] = hue_b[face];
- } else {
- int l2 = texture_viewpoint_x[b];
- int l3 = texture_viewpoint_y[b];
- int l4 = hue_b[face];
- if (l1 >= 50) {
- int i6 = (50 - i2) * modelIntArray4[l1 - i2];
- anIntArray1678[l] = center_x + (l2 + ((texture_viewpoint_x[a] - l2) * i6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1679[l] = center_y + (l3 + ((texture_viewpoint_y[a] - l3) * i6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1680[l++] = l4 + ((hue_a[face] - l4) * i6 >> 16);
- }
- if (j2 >= 50) {
- int j6 = (50 - i2) * modelIntArray4[j2 - i2];
- anIntArray1678[l] = center_x + (l2 + ((texture_viewpoint_x[c] - l2) * j6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1679[l] = center_y + (l3 + ((texture_viewpoint_y[c] - l3) * j6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1680[l++] = l4 + ((hue_c[face] - l4) * j6 >> 16);
- }
- }
- if (j2 >= 50) {
- anIntArray1678[l] = vertex_viewpoint_x[c];
- anIntArray1679[l] = vertex_viewpoint_y[c];
- anIntArray1680[l++] = hue_c[face];
- } else {
- int i3 = texture_viewpoint_x[c];
- int i4 = texture_viewpoint_y[c];
- int i5 = hue_c[face];
- if (i2 >= 50) {
- int k6 = (50 - j2) * modelIntArray4[i2 - j2];
- anIntArray1678[l] = center_x + (i3 + ((texture_viewpoint_x[b] - i3) * k6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1679[l] = center_y + (i4 + ((texture_viewpoint_y[b] - i4) * k6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1680[l++] = i5 + ((hue_b[face] - i5) * k6 >> 16);
- }
- if (l1 >= 50) {
- int l6 = (50 - j2) * modelIntArray4[l1 - j2];
- anIntArray1678[l] = center_x + (i3 + ((texture_viewpoint_x[a] - i3) * l6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1679[l] = center_y + (i4 + ((texture_viewpoint_y[a] - i4) * l6 >> 16) << SceneGraph.viewDistance) / 50;
- anIntArray1680[l++] = i5 + ((hue_a[face] - i5) * l6 >> 16);
- }
- }
- int y_a = anIntArray1678[0];
- int y_b = anIntArray1678[1];
- int y_c = anIntArray1678[2];
- int x_a = anIntArray1679[0];
- int x_b = anIntArray1679[1];
- int x_c = anIntArray1679[2];
- if ((y_a - y_b) * (x_c - x_b) - (x_a - x_b) * (y_c - y_b) > 0) {
- Rasterizer.aBoolean1462 = false;
- int texture_a = a;
- int texture_b = b;
- int texture_c = c;
- if (l == 3) {
- if (y_a < 0 || y_b < 0 || y_c < 0 || y_a > Raster.center_x || y_b > Raster.center_x || y_c > Raster.center_x)
- Rasterizer.aBoolean1462 = true;
- int type;
- if (render_type == null)
- type = 0;
- else
- type = render_type[face] & 3;
- if(texture != null && texture[face] != -1) {
- if(texture_coordinates != null && texture_coordinates[face] != -1) {
- int coordinate = texture_coordinates[face] & 0xff;
- texture_a = texture_edge_a[coordinate];
- texture_b = texture_edge_b[coordinate];
- texture_c = texture_edge_c[coordinate];
- }
- if(hue_c[face] == -1) {
- Rasterizer.drawTexturedTriangle(
- x_a, x_b, x_c,
- y_a, y_b, y_c,
- hue_a[face], hue_a[face], hue_a[face],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- } else {
- Rasterizer.drawTexturedTriangle(
- x_a, x_b, x_c,
- y_a, y_b, y_c,
- anIntArray1680[0], anIntArray1680[1], anIntArray1680[2],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- }
- } else if(hue_c[face] == -1) {
- Rasterizer.drawFlatTriangle(x_a, x_b, x_c, y_a, y_b, y_c, modelIntArray3[hue_a[face]], -1f, -1f, -1f);
- } else {
- if (type == 0) {
- Rasterizer.drawShadedTriangle(x_a, x_b, x_c, y_a, y_b, y_c, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], -1f, -1f, -1f);
- }
- }
- }
- if (l == 4) {
- if (y_a < 0 || y_b < 0 || y_c < 0 || y_a > Raster.center_x || y_b > Raster.center_x || y_c > Raster.center_x || anIntArray1678[3] < 0 || anIntArray1678[3] > Raster.center_x)
- Rasterizer.aBoolean1462 = true;
- int type;
- if (render_type == null)
- type = 0;
- else
- type = render_type[face] & 3;
- if(texture != null && texture[face] != -1) {
- if(texture_coordinates != null && texture_coordinates[face] != -1) {
- int coordinate = texture_coordinates[face] & 0xff;
- texture_a = texture_edge_a[coordinate];
- texture_b = texture_edge_b[coordinate];
- texture_c = texture_edge_c[coordinate];
- }
- if(hue_c[face] == -1) {
- Rasterizer.drawTexturedTriangle(
- x_a, x_b, x_c,
- y_a, y_b, y_c,
- hue_a[face], hue_a[face], hue_a[face],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- Rasterizer.drawTexturedTriangle(
- x_a, x_c, anIntArray1679[3],
- y_a, y_c, anIntArray1678[3],
- hue_a[face], hue_a[face], hue_a[face],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- } else {
- Rasterizer.drawTexturedTriangle(
- x_a, x_b, x_c,
- y_a, y_b, y_c,
- anIntArray1680[0], anIntArray1680[1], anIntArray1680[2],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- Rasterizer.drawTexturedTriangle(
- x_a, x_c, anIntArray1679[3],
- y_a, y_c, anIntArray1678[3],
- anIntArray1680[0], anIntArray1680[2], anIntArray1680[3],
- texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
- texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
- texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
- texture[face],
- vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- return;
- }
- } else if(hue_c[face] == -1) {
- int l8 = modelIntArray3[hue_a[face]];
- Rasterizer.drawFlatTriangle(x_a, x_b, x_c, y_a, y_b, y_c, l8, -1f, -1f, -1f);
- Rasterizer.drawFlatTriangle(x_a, x_c, anIntArray1679[3], y_a, y_c, anIntArray1678[3], l8, vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- return;
- } else {
- if (type == 0) {
- Rasterizer.drawShadedTriangle(x_a, x_b, x_c, y_a, y_b, y_c, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], -1f, -1f, -1f);
- Rasterizer.drawShadedTriangle(x_a, x_c, anIntArray1679[3], y_a, y_c, anIntArray1678[3], anIntArray1680[0], anIntArray1680[2], anIntArray1680[3], vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
- return;
- }
- }
- }
- }
- }
- private final boolean method486(int i, int j, int k, int l, int i1, int x_a, int x_b, int x_c) {
- if (j < k && j < l && j < i1)
- return false;
- if (j > k && j > l && j > i1)
- return false;
- if (i < x_a && i < x_b && i < x_c)
- return false;
- return i <= x_a || i <= x_b || i <= x_c;
- }
- //*Added*//
- public short[] texture;//face_material
- public byte[] texture_coordinates;//face_texture
- public byte[] texture_type;//texture_map
- public int[] particle_vertices;
- //*Default*//
- private boolean aBoolean1618;
- public static int anInt1620;
- public static Model EMPTY_MODEL = new Model(true);
- private static int anIntArray1622[] = new int[2000];
- private static int anIntArray1623[] = new int[2000];
- private static int anIntArray1624[] = new int[2000];
- private static int anIntArray1625[] = new int[2000];
- public int vertices;
- public int vertexX[];
- public int vertexY[];
- public int vertexZ[];
- public int faces;
- public int edge_a[];
- public int edge_b[];
- public int edge_c[];
- public int hue_a[];
- public int hue_b[];
- public int hue_c[];
- public int render_type[];
- public byte render_priorities[];
- public int alpha[];
- public short color[];
- public byte priority = 0;
- public int texture_faces;
- public short texture_edge_a[];//texture_edge_p
- public short texture_edge_b[];//texture_edge_m
- public short texture_edge_c[];//texture_edge_n
- public int anInt1646;
- public int anInt1647;
- public int anInt1648;
- public int anInt1649;
- public int anInt1650;
- public int anInt1651;
- public int anInt1652;
- public int anInt1653;
- public int anInt1654;
- public int vSkin[];//bone_skin
- public int tSkin[];//muscle_skin
- public int vertex_skin[][];
- public int face_skin[][];
- public boolean fits_on_single_square;
- public Vertex gouraud_vertex[];
- static ModelHeader header[];
- static Provider resourceProvider;
- static boolean aBooleanArray1663[] = new boolean[4700];
- static boolean scale_textures[] = new boolean[4700];
- static int vertex_viewpoint_x[] = new int[4700];
- static int vertex_viewpoint_y[] = new int[4700];
- static int vertex_viewpoint_z[] = new int[4700];
- static int anIntArray1667[] = new int[4700];
- static int texture_viewpoint_x[] = new int[4700];
- static int texture_viewpoint_y[] = new int[4700];
- static int texture_viewpoint_z[] = new int[4700];
- static int anIntArray1671[] = new int[1600];//1500
- static int anIntArrayArray1672[][] = new int[1600][64];//1500 / 512 //anIntArrayArray3809
- static int anIntArray1673[] = new int[12];
- static int anIntArrayArray1674[][] = new int[12][2000];//1500
- static int anIntArray1676[] = new int[2000];//1500
- static int anIntArray1675[] = new int[2000];//1500
- static int anIntArray1677[] = new int[12];
- static int anIntArray1678[] = new int[10];
- static int anIntArray1679[] = new int[10];
- static int anIntArray1680[] = new int[10];
- static int anInt1681;
- static int anInt1682;
- static int anInt1683;
- public static boolean objectExists;
- public static int anInt1685;
- public static int anInt1686;
- public static int anInt1687;
- public static long objectsInCurrentRegion[] = new long[1000];
- public static int SINE[];
- public static int COSINE[];
- static int modelIntArray3[];
- static int modelIntArray4[];
- static final void method2395() {
- aBoolean3833 = false;
- anIntArray3826 = null;
- anIntArray3810 = null;
- anIntArray3832 = new int[1600];
- anIntArrayArray3813 = new int[1600][64];
- anIntArray3815 = new int[32];
- anIntArrayArray3809 = new int[32][512];
- }
- static final void method2404() {
- aBoolean3833 = true;
- anIntArray3826 = new int[4096];
- anIntArray3810 = new int[4096];
- anIntArray3832 = null;
- anIntArrayArray3813 = null;
- anIntArray3815 = null;
- anIntArrayArray3809 = null;
- }
- private static int anInt3814;
- private static boolean aBoolean3833;//tile_particle
- private static int[] anIntArray3826;
- private static int[] anIntArray3810;
- private static int[] anIntArray3832;
- private static int[][] anIntArrayArray3813;
- private static int[] anIntArray3815;
- private static int[][] anIntArrayArray3809;
- ModelParticleEmitter[] aClass158Array3788;
- ModelParticleMagnet[] aClass169Array3776;
- private static int[] anIntArray3812;
- private static int[] anIntArray3806;
- private static int[] anIntArray3834;
- private static int[] anIntArray3821;
- private static int[] anIntArray3818;
- static {
- SINE = Rasterizer.SINE;
- COSINE = Rasterizer.COSINE;
- modelIntArray3 = Rasterizer.anIntArray1482;
- modelIntArray4 = Rasterizer.anIntArray1469;
- anInt3814 = 0;
- aBoolean3833 = false;
- if (aBoolean3833) {
- anIntArray3826 = new int[4096];
- anIntArray3810 = new int[4096];
- } else {
- anIntArray3832 = new int[1600];
- anIntArrayArray3813 = new int[1600][64];
- anIntArray3815 = new int[32];
- anIntArrayArray3809 = new int[32][512];
- }
- anIntArray3812 = new int[8192];
- anIntArray3806 = new int[8192];
- anIntArray3834 = new int[8192];
- anIntArray3821 = new int[8192];
- anIntArray3818 = new int[8192];
- }
- public int field1944;
- public int field1947;
- public int field1963;
- public int field1948;
- public int field1946;
- public int field1924;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement