Tons of renaming

This commit is contained in:
thedaneeffect committed 2022-07-19 21:28:55 -06:00
1 parent e5438f79a4
commit 172a880a85
20 files changed
+1242 -1046

No files matched your search

+5 -5
View File
@@ -184,10 +184,10 @@ public class Buffer extends DoublyLinkedList.Node {
*/
public int getSmart() {
int i = data[position] & 0xff;
if (i < 0x80) {
return get1U() - 0x40;
if (i < 128) {
return get1U() - 64;
} else {
return get2U() - 0xC000;
return get2U() - 49152;
}
}
@@ -198,10 +198,10 @@ public class Buffer extends DoublyLinkedList.Node {
*/
public int getSmartU() {
int i = data[position] & 0xff;
if (i < 0x80) {
if (i < 128) {
return get1U();
} else {
return get2U() - 0x8000;
return get2U() - 32768;
}
}
+9 -12
View File
@@ -165,13 +165,13 @@ public class Component {
int tmp = in.get1U();
if (tmp != 0) {
c.modelCategory = 1;
c.modelID = ((tmp - 1) << 8) + in.get1U();
c.modelId = ((tmp - 1) << 8) + in.get1U();
}
tmp = in.get1U();
if (tmp != 0) {
c.activeModelCategory = 1;
c.activeModelID = ((tmp - 1) << 8) + in.get1U();
c.activeModelId = ((tmp - 1) << 8) + in.get1U();
}
tmp = in.get1U();
@@ -270,7 +270,7 @@ public class Component {
public int activeHoverColor;
public Image24 activeImage;
public int activeModelCategory;
public int activeModelID;
public int activeModelId;
public int activeSeqId;
public String activeText;
public boolean center;
@@ -300,7 +300,7 @@ public class Component {
public boolean invUsable;
public int modelEyePitch;
public int modelCategory;
public int modelID;
public int modelId;
public int modelYaw;
public int modelZoom;
public String option;
@@ -350,16 +350,13 @@ public class Component {
model = Model.tryGet(id);
}
if (category == 2) {
model = NPCType.get(id).method160();
model = NPCType.get(id).getUnlitHeadModel();
}
if (category == 3) {
model = Game.localPlayer.method453();
model = Game.localPlayer.getUnlitHeadModel();
}
if (category == 4) {
model = ObjType.get(id).getModelUnlit(50);
}
if (category == 5) {
model = null;
model = ObjType.get(id).getUnlitModel(50);
}
if (model != null) {
modelCache.put((long) ((category << 16) + id), model);
@@ -371,9 +368,9 @@ public class Component {
Model model;
if (active) {
model = getModel(activeModelCategory, activeModelID);
model = getModel(activeModelCategory, activeModelId);
} else {
model = getModel(modelCategory, modelID);
model = getModel(modelCategory, modelId);
}
if (model == null) {
+120 -96
View File
@@ -6,16 +6,16 @@ import java.io.IOException;
public class FloType {
public static int anInt387;
public static int count;
public static FloType[] instances;
public static void unpack(FileArchive archive) throws IOException {
Buffer buffer = new Buffer(archive.read("flo.dat"));
anInt387 = buffer.get2U();
count = buffer.get2U();
if (instances == null) {
instances = new FloType[anInt387];
instances = new FloType[count];
}
for (int j = 0; j < anInt387; j++) {
for (int j = 0; j < count; j++) {
if (instances[j] == null) {
instances[j] = new FloType();
}
@@ -24,16 +24,16 @@ public class FloType {
}
public String unusedString;
public int anInt390;
public int rgb;
public int textureId = -1;
public boolean unusedBool = false;
public boolean aBoolean393 = true;
public int anInt394;
public int anInt395;
public int anInt396;
public int anInt397;
public int anInt398;
public int anInt399;
public int hue;
public int saturation;
public int lightness;
public int chroma;
public int luminance;
public int hsl;
public FloType() {
}
@@ -45,8 +45,8 @@ public class FloType {
return;
}
if (i == 1) {
anInt390 = buffer.get3();
method262(anInt390);
rgb = buffer.get3();
setColor(rgb);
} else if (i == 2) {
textureId = buffer.get1U();
} else if (i == 3) {
@@ -56,117 +56,141 @@ public class FloType {
} else if (i == 6) {
unusedString = buffer.getString();
} else if (i == 7) {
int j = anInt394;
int k = anInt395;
int l = anInt396;
int i1 = anInt397;
int j1 = buffer.get3();
method262(j1);
anInt394 = j;
anInt395 = k;
anInt396 = l;
anInt397 = i1;
anInt398 = i1;
int hue = this.hue;
int saturation = this.saturation;
int lightness = this.lightness;
int chroma = this.chroma;
int rgb = buffer.get3();
setColor(rgb);
this.hue = hue;
this.saturation = saturation;
this.lightness = lightness;
this.chroma = chroma;
luminance = chroma;
} else {
System.out.println("Error unrecognised config code: " + i);
}
} while (true);
}
public void method262(int i) {
double d = (double) ((i >> 16) & 0xff) / 256D;
double d1 = (double) ((i >> 8) & 0xff) / 256D;
double d2 = (double) (i & 0xff) / 256D;
double d3 = d;
if (d1 < d3) {
d3 = d1;
public void setColor(int rgb) {
double red = (double) ((rgb >> 16) & 0xff) / 256D;
double green = (double) ((rgb >> 8) & 0xff) / 256D;
double blue = (double) (rgb & 0xff) / 256D;
double min = red;
if (green < min) {
min = green;
}
if (d2 < d3) {
d3 = d2;
if (blue < min) {
min = blue;
}
double d4 = d;
if (d1 > d4) {
d4 = d1;
double max = red;
if (green > max) {
max = green;
}
if (d2 > d4) {
d4 = d2;
if (blue > max) {
max = blue;
}
double d5 = 0.0D;
double d6 = 0.0D;
double d7 = (d3 + d4) / 2D;
if (d3 != d4) {
if (d7 < 0.5D) {
d6 = (d4 - d3) / (d4 + d3);
double h = 0.0D;
double s = 0.0D;
double l = (min + max) / 2D;
if (min != max) {
if (l < 0.5D) {
s = (max - min) / (max + min);
}
if (d7 >= 0.5D) {
d6 = (d4 - d3) / (2D - d4 - d3);
if (l >= 0.5D) {
s = (max - min) / (2D - max - min);
}
if (d == d4) {
d5 = (d1 - d2) / (d4 - d3);
} else if (d1 == d4) {
d5 = 2D + ((d2 - d) / (d4 - d3));
} else if (d2 == d4) {
d5 = 4D + ((d - d1) / (d4 - d3));
if (red == max) {
h = (green - blue) / (max - min);
} else if (green == max) {
h = 2D + ((blue - red) / (max - min));
} else if (blue == max) {
h = 4D + ((red - green) / (max - min));
}
}
d5 /= 6D;
anInt394 = (int) (d5 * 256D);
anInt395 = (int) (d6 * 256D);
anInt396 = (int) (d7 * 256D);
if (anInt395 < 0) {
anInt395 = 0;
} else if (anInt395 > 255) {
anInt395 = 255;
h /= 6D;
this.hue = (int) (h * 256D);
this.saturation = (int) (s * 256D);
this.lightness = (int) (l * 256D);
if (this.saturation < 0) {
this.saturation = 0;
} else if (this.saturation > 255) {
this.saturation = 255;
}
if (anInt396 < 0) {
anInt396 = 0;
} else if (anInt396 > 255) {
anInt396 = 255;
if (this.lightness < 0) {
this.lightness = 0;
} else if (this.lightness > 255) {
this.lightness = 255;
}
if (d7 > 0.5D) {
anInt398 = (int) ((1.0D - d7) * d6 * 512D);
if (l > 0.5D) {
luminance = (int) ((1.0D - l) * s * 512D);
} else {
anInt398 = (int) (d7 * d6 * 512D);
luminance = (int) (l * s * 512D);
}
if (anInt398 < 1) {
anInt398 = 1;
if (luminance < 1) {
luminance = 1;
}
anInt397 = (int) (d5 * (double) anInt398);
int k = (anInt394 + (int) (Math.random() * 16D)) - 8;
if (k < 0) {
k = 0;
} else if (k > 255) {
k = 255;
chroma = (int) (h * (double) luminance);
int hue = (this.hue + (int) (Math.random() * 16D)) - 8;
if (hue < 0) {
hue = 0;
} else if (hue > 255) {
hue = 255;
}
int l = (anInt395 + (int) (Math.random() * 48D)) - 24;
if (l < 0) {
l = 0;
} else if (l > 255) {
l = 255;
int saturation = (this.saturation + (int) (Math.random() * 48D)) - 24;
if (saturation < 0) {
saturation = 0;
} else if (saturation > 255) {
saturation = 255;
}
int i1 = (anInt396 + (int) (Math.random() * 48D)) - 24;
if (i1 < 0) {
i1 = 0;
} else if (i1 > 255) {
i1 = 255;
int lightness = (this.lightness + (int) (Math.random() * 48D)) - 24;
if (lightness < 0) {
lightness = 0;
} else if (lightness > 255) {
lightness = 255;
}
anInt399 = method263(k, l, i1);
hsl = decimateHSL(hue, saturation, lightness);
}
public int method263(int i, int j, int k) {
if (k > 179) {
j /= 2;
public int decimateHSL(int hue, int saturation, int lightness) {
if (lightness > 179) {
saturation /= 2;
}
if (k > 192) {
j /= 2;
if (lightness > 192) {
saturation /= 2;
}
if (k > 217) {
j /= 2;
if (lightness > 217) {
saturation /= 2;
}
if (k > 243) {
j /= 2;
if (lightness > 243) {
saturation /= 2;
}
return ((i / 4) << 10) + ((j / 32) << 7) + (k / 2);
return ((hue / 4) << 10) + ((saturation / 32) << 7) + (lightness / 2);
}
}
+288 -267
View File
File diff suppressed because it is too large. Load diff
+40 -40
View File
@@ -6,16 +6,16 @@ import java.io.IOException;
public class IDKType {
public static int anInt655;
public static int count;
public static IDKType[] instances;
public static void unpack(FileArchive archive) throws IOException {
Buffer buffer = new Buffer(archive.read("idk.dat"));
anInt655 = buffer.get2U();
count = buffer.get2U();
if (instances == null) {
instances = new IDKType[anInt655];
instances = new IDKType[count];
}
for (int j = 0; j < anInt655; j++) {
for (int j = 0; j < count; j++) {
if (instances[j] == null) {
instances[j] = new IDKType();
}
@@ -23,12 +23,12 @@ public class IDKType {
}
}
public final int[] anIntArray659 = new int[6];
public final int[] anIntArray660 = new int[6];
public final int[] anIntArray661 = {-1, -1, -1, -1, -1};
public int anInt657 = -1;
public int[] anIntArray658;
public boolean aBoolean662 = false;
public final int[] colorSrc = new int[6];
public final int[] colorDst = new int[6];
public final int[] headModelIds = {-1, -1, -1, -1, -1};
public int type = -1;
public int[] modelIds;
public boolean selectable = false;
public IDKType() {
}
@@ -40,47 +40,47 @@ public class IDKType {
return;
}
if (i == 1) {
anInt657 = buffer.get1U();
type = buffer.get1U();
} else if (i == 2) {
int j = buffer.get1U();
anIntArray658 = new int[j];
modelIds = new int[j];
for (int k = 0; k < j; k++) {
anIntArray658[k] = buffer.get2U();
modelIds[k] = buffer.get2U();
}
} else if (i == 3) {
aBoolean662 = true;
selectable = true;
} else if ((i >= 40) && (i < 50)) {
anIntArray659[i - 40] = buffer.get2U();
colorSrc[i - 40] = buffer.get2U();
} else if ((i >= 50) && (i < 60)) {
anIntArray660[i - 50] = buffer.get2U();
colorDst[i - 50] = buffer.get2U();
} else if ((i >= 60) && (i < 70)) {
anIntArray661[i - 60] = buffer.get2U();
headModelIds[i - 60] = buffer.get2U();
} else {
System.out.println("Error unrecognised config code: " + i);
}
} while (true);
}
public boolean method537() {
if (anIntArray658 == null) {
public boolean validateModel() {
if (modelIds == null) {
return true;
}
boolean flag = true;
for (int i : anIntArray658) {
if (!Model.validate(i)) {
flag = false;
boolean loaded = true;
for (int modelId : modelIds) {
if (!Model.validate(modelId)) {
loaded = false;
}
}
return flag;
return loaded;
}
public Model method538() {
if (anIntArray658 == null) {
public Model getModel() {
if (modelIds == null) {
return null;
}
Model[] aclass30_sub2_sub4_sub6 = new Model[anIntArray658.length];
for (int i = 0; i < anIntArray658.length; i++) {
aclass30_sub2_sub4_sub6[i] = Model.tryGet(anIntArray658[i]);
Model[] aclass30_sub2_sub4_sub6 = new Model[modelIds.length];
for (int i = 0; i < modelIds.length; i++) {
aclass30_sub2_sub4_sub6[i] = Model.tryGet(modelIds[i]);
}
Model model;
if (aclass30_sub2_sub4_sub6.length == 1) {
@@ -89,38 +89,38 @@ public class IDKType {
model = new Model(aclass30_sub2_sub4_sub6.length, aclass30_sub2_sub4_sub6);
}
for (int j = 0; j < 6; j++) {
if (anIntArray659[j] == 0) {
if (colorSrc[j] == 0) {
break;
}
model.recolor(anIntArray659[j], anIntArray660[j]);
model.recolor(colorSrc[j], colorDst[j]);
}
return model;
}
public boolean method539() {
boolean flag1 = true;
public boolean validateHeadModel() {
boolean loaded = true;
for (int i = 0; i < 5; i++) {
if ((anIntArray661[i] != -1) && !Model.validate(anIntArray661[i])) {
flag1 = false;
if ((headModelIds[i] != -1) && !Model.validate(headModelIds[i])) {
loaded = false;
}
}
return flag1;
return loaded;
}
public Model method540() {
Model[] aclass30_sub2_sub4_sub6 = new Model[5];
int j = 0;
for (int k = 0; k < 5; k++) {
if (anIntArray661[k] != -1) {
aclass30_sub2_sub4_sub6[j++] = Model.tryGet(anIntArray661[k]);
if (headModelIds[k] != -1) {
aclass30_sub2_sub4_sub6[j++] = Model.tryGet(headModelIds[k]);
}
}
Model model = new Model(j, aclass30_sub2_sub4_sub6);
for (int l = 0; l < 6; l++) {
if (anIntArray659[l] == 0) {
if (colorSrc[l] == 0) {
break;
}
model.recolor(anIntArray659[l], anIntArray660[l]);
model.recolor(colorSrc[l], colorDst[l]);
}
return model;
}
+28 -28
View File
@@ -99,7 +99,7 @@ public class LocType {
*/
public boolean dynamic;
public int scaleZ;
public int[] modelIDs;
public int[] modelIds;
public int varbit;
public int decorationPadding;
public int[] modelKinds;
@@ -115,7 +115,7 @@ public class LocType {
}
public void reset() {
modelIDs = null;
modelIds = null;
modelKinds = null;
name = null;
description = null;
@@ -154,31 +154,31 @@ public class LocType {
}
public void method574(OnDemand onDemand) {
if (modelIDs == null) {
if (modelIds == null) {
return;
}
for (int k : modelIDs) {
for (int k : modelIds) {
onDemand.method560(k & 0xffff, 0);
}
}
public boolean validate(int kind) {
if (modelKinds == null) {
if (modelIDs == null) {
if (modelIds == null) {
return true;
}
if (kind != 10) {
return true;
}
boolean valid = true;
for (int modelID : modelIDs) {
for (int modelID : modelIds) {
valid &= Model.validate(modelID & 0xffff);
}
return valid;
}
for (int i = 0; i < modelKinds.length; i++) {
if (modelKinds[i] == kind) {
return Model.validate(modelIDs[i] & 0xffff);
return Model.validate(modelIds[i] & 0xffff);
}
}
return true;
@@ -211,11 +211,11 @@ public class LocType {
}
public boolean method579() {
if (modelIDs == null) {
if (modelIds == null) {
return true;
}
boolean flag1 = true;
for (int j : modelIDs) {
for (int j : modelIds) {
flag1 &= Model.validate(j & 0xffff);
}
return flag1;
@@ -258,30 +258,30 @@ public class LocType {
return cached;
}
if (modelIDs == null) {
if (modelIds == null) {
return null;
}
boolean flip = invert ^ (rotation > 3);
int modelCount = modelIDs.length;
int modelCount = modelIds.length;
for (int i = 0; i < modelCount; i++) {
int modelID = modelIDs[i];
int modelId = modelIds[i];
if (flip) {
modelID += 0x10000;
modelId += 0x10000;
}
model = staticCache.get(modelID);
model = staticCache.get(modelId);
if (model == null) {
model = Model.tryGet(modelID & 0xffff);
model = Model.tryGet(modelId & 0xffff);
if (model == null) {
return null;
}
if (flip) {
model.rotateY180();
}
staticCache.put((long) modelID, model);
staticCache.put((long) modelId, model);
}
if (modelCount > 1) {
@@ -315,17 +315,17 @@ public class LocType {
return cached;
}
int modelID = modelIDs[kindIndex];
int modelId = modelIds[kindIndex];
boolean flip = invert ^ (rotation > 3);
if (flip) {
modelID += 0x10000;
modelId += 0x10000;
}
model = staticCache.get(modelID);
model = staticCache.get(modelId);
if (model == null) {
model = Model.tryGet(modelID & 0xffff);
model = Model.tryGet(modelId & 0xffff);
if (model == null) {
return null;
@@ -335,7 +335,7 @@ public class LocType {
model.rotateY180();
}
staticCache.put((long) modelID, model);
staticCache.put((long) modelId, model);
}
}
@@ -392,11 +392,11 @@ public class LocType {
if (j == 1) {
int k = buffer.get1U();
if (k > 0) {
if ((modelIDs == null) || lowmem) {
if ((modelIds == null) || lowmem) {
modelKinds = new int[k];
modelIDs = new int[k];
modelIds = new int[k];
for (int k1 = 0; k1 < k; k1++) {
modelIDs[k1] = buffer.get2U();
modelIds[k1] = buffer.get2U();
modelKinds[k1] = buffer.get1U();
}
} else {
@@ -410,11 +410,11 @@ public class LocType {
} else if (j == 5) {
int l = buffer.get1U();
if (l > 0) {
if ((modelIDs == null) || lowmem) {
if ((modelIds == null) || lowmem) {
modelKinds = null;
modelIDs = new int[l];
modelIds = new int[l];
for (int l1 = 0; l1 < l; l1++) {
modelIDs[l1] = buffer.get2U();
modelIds[l1] = buffer.get2U();
}
} else {
buffer.position += l * 2;
@@ -518,7 +518,7 @@ public class LocType {
}
} while (true);
if (i == -1) {
interactable = (modelIDs != null) && ((modelKinds == null) || (modelKinds[0] == 10));
interactable = (modelIds != null) && ((modelKinds == null) || (modelKinds[0] == 10));
if (actions != null) {
interactable = true;
}
+37 -27
View File
@@ -9,20 +9,22 @@ public class NPCEntity extends PathingEntity {
public NPCEntity() {
}
public Model method450() {
if ((super.anInt1526 >= 0) && (super.anInt1529 == 0)) {
int k = SeqType.instances[super.anInt1526].primaryFrames[super.anInt1527];
int i1 = -1;
if ((super.seqCurrent >= 0) && (super.seqCurrent != super.seqStand)) {
i1 = SeqType.instances[super.seqCurrent].primaryFrames[super.seqFrame];
public Model getSequencedModel() {
if ((super.seqId1 >= 0) && (super.anInt1529 == 0)) {
int frame1 = SeqType.instances[super.seqId1].primaryFrames[super.seqFrame1];
int frame2 = -1;
if ((super.seqId2 >= 0) && (super.seqId2 != super.seqStand)) {
frame2 = SeqType.instances[super.seqId2].primaryFrames[super.seqFrame2];
}
return type.method164(i1, k, SeqType.instances[super.anInt1526].anIntArray357);
return type.getSequencedModel(frame2, frame1, SeqType.instances[super.seqId1].anIntArray357);
}
int l = -1;
if (super.seqCurrent >= 0) {
l = SeqType.instances[super.seqCurrent].primaryFrames[super.seqFrame];
int frame = -1;
if (super.seqId2 >= 0) {
frame = SeqType.instances[super.seqId2].primaryFrames[super.seqFrame2];
}
return type.method164(-1, l, null);
return type.getSequencedModel(-1, frame, null);
}
@Override
@@ -30,28 +32,36 @@ public class NPCEntity extends PathingEntity {
if (type == null) {
return null;
}
Model model = method450();
Model model = getSequencedModel();
if (model == null) {
return null;
}
super.height = model.minY;
if ((super.spotanim != -1) && (super.spotanimFrame != -1)) {
SpotAnimType type = SpotAnimType.instances[super.spotanim];
Model model_1 = type.method266();
if (model_1 != null) {
int j = type.seq.primaryFrames[super.spotanimFrame];
Model class30_sub2_sub4_sub6_2 = new Model(true, SeqFrame.isNull(j), false, model_1);
class30_sub2_sub4_sub6_2.translate(0, -super.anInt1524, 0);
class30_sub2_sub4_sub6_2.createLabelReferences();
class30_sub2_sub4_sub6_2.applySequenceFrame(j);
class30_sub2_sub4_sub6_2.labelFaces = null;
class30_sub2_sub4_sub6_2.labelVertices = null;
if ((type.anInt410 != 128) || (type.anInt411 != 128)) {
class30_sub2_sub4_sub6_2.scale(type.anInt410, type.anInt410, type.anInt411);
SpotAnimType spotanim = SpotAnimType.instances[super.spotanim];
Model model0 = spotanim.getModel();
if (model0 != null) {
int frame = spotanim.seq.primaryFrames[super.spotanimFrame];
// create a copy of the model
Model model1 = new Model(true, SeqFrame.isNull(frame), false, model0);
model1.translate(0, -super.spotanimY, 0);
model1.createLabelReferences();
model1.applySequenceFrame(frame);
model1.labelFaces = null;
model1.labelVertices = null;
if ((spotanim.scaleXY != 128) || (spotanim.scaleZ != 128)) {
model1.scale(spotanim.scaleXY, spotanim.scaleXY, spotanim.scaleZ);
}
class30_sub2_sub4_sub6_2.calculateNormals(64 + type.anInt413, 850 + type.anInt414, -30, -50, -30, true);
Model[] aclass30_sub2_sub4_sub6 = {model, class30_sub2_sub4_sub6_2};
model = new Model(2, -819, aclass30_sub2_sub4_sub6);
model1.calculateNormals(64 + spotanim.lightAmbient, 850 + spotanim.lightAttenuation, -30, -50, -30, true);
model = new Model(2, -819, new Model[]{model, model1});
}
}
if (type.size == 1) {
+91 -71
View File
@@ -56,20 +56,20 @@ public class NPCType {
dat = null;
}
public int seqTurnRight = -1;
public int varbit = -1;
public int seqTurnAround = -1;
public int varp = -1;
public int anInt61 = -1;
public int seqTurnRightId = -1;
public int varbitId = -1;
public int seqTurnAroundId = -1;
public int varpId = -1;
public int level = -1;
public String name;
public String[] op;
public int seqWalk = -1;
public int seqWalkId = -1;
public byte size = 1;
public int[] anIntArray70;
public int[] colorDst;
public int unusedInt0 = -1;
public int[] anIntArray73;
public int[] headModelIds;
public int headicon = -1;
public int[] anIntArray76;
public int[] colorSrc;
public int seqStand = -1;
public long uid = -1L;
public int turnSpeed = 32;
@@ -84,46 +84,55 @@ public class NPCType {
public int anInt91 = 128;
public int anInt92;
public boolean aBoolean93 = false;
public int[] anIntArray94;
public int[] modelIds;
public int unusedInt2 = -1;
public NPCType() {
}
public Model method160() {
public Model getUnlitHeadModel() {
if (overrides != null) {
NPCType type = getOverrideType();
if (type == null) {
return null;
} else {
return type.method160();
return type.getUnlitHeadModel();
}
}
if (anIntArray73 == null) {
if (headModelIds == null) {
return null;
}
boolean flag1 = false;
for (int value : anIntArray73) {
boolean loaded = false;
for (int value : headModelIds) {
if (!Model.validate(value)) {
flag1 = true;
loaded = true;
}
}
if (flag1) {
if (loaded) {
return null;
}
Model[] aclass30_sub2_sub4_sub6 = new Model[anIntArray73.length];
for (int j = 0; j < anIntArray73.length; j++) {
aclass30_sub2_sub4_sub6[j] = Model.tryGet(anIntArray73[j]);
Model[] models = new Model[headModelIds.length];
for (int i = 0; i < headModelIds.length; i++) {
models[i] = Model.tryGet(headModelIds[i]);
}
Model model;
if (aclass30_sub2_sub4_sub6.length == 1) {
model = aclass30_sub2_sub4_sub6[0];
if (models.length == 1) {
model = models[0];
} else {
model = new Model(aclass30_sub2_sub4_sub6.length, aclass30_sub2_sub4_sub6);
model = new Model(models.length, models);
}
if (anIntArray76 != null) {
for (int k = 0; k < anIntArray76.length; k++) {
model.recolor(anIntArray76[k], anIntArray70[k]);
if (colorSrc != null) {
for (int i = 0; i < colorSrc.length; i++) {
model.recolor(colorSrc[i], colorDst[i]);
}
}
return model;
@@ -132,15 +141,15 @@ public class NPCType {
public NPCType getOverrideType() {
int value = -1;
if (varbit != -1) {
VarbitType vb = VarbitType.instances[this.varbit];
if (varbitId != -1) {
VarbitType vb = VarbitType.instances[this.varbitId];
int varp = vb.varp;
int lsb = vb.lsb;
int msb = vb.msb;
int mask = Game.BITMASK[msb - lsb];
value = (game.variables[varp] >> lsb) & mask;
} else if (varp != -1) {
value = game.variables[varp];
} else if (varpId != -1) {
value = game.variables[varpId];
}
if ((value < 0) || (value >= overrides.length) || (overrides[value] == -1)) {
@@ -150,59 +159,70 @@ public class NPCType {
}
}
public Model method164(int j, int k, int[] ai) {
public Model getSequencedModel(int seqFrame2, int seqFrame1, int[] seqMask) {
if (overrides != null) {
NPCType type = getOverrideType();
if (type == null) {
NPCType override = getOverrideType();
if (override == null) {
return null;
} else {
return type.method164(j, k, ai);
return override.getSequencedModel(seqFrame2, seqFrame1, seqMask);
}
}
Model model = modelCache.get(uid);
if (model == null) {
boolean flag = false;
for (int value : anIntArray94) {
boolean invalid = false;
for (int value : modelIds) {
if (!Model.validate(value)) {
flag = true;
invalid = true;
}
}
if (flag) {
if (invalid) {
return null;
}
Model[] aclass30_sub2_sub4_sub6 = new Model[anIntArray94.length];
for (int j1 = 0; j1 < anIntArray94.length; j1++) {
aclass30_sub2_sub4_sub6[j1] = Model.tryGet(anIntArray94[j1]);
Model[] models = new Model[modelIds.length];
for (int i = 0; i < modelIds.length; i++) {
models[i] = Model.tryGet(modelIds[i]);
}
if (aclass30_sub2_sub4_sub6.length == 1) {
model = aclass30_sub2_sub4_sub6[0];
if (models.length == 1) {
model = models[0];
} else {
model = new Model(aclass30_sub2_sub4_sub6.length, aclass30_sub2_sub4_sub6);
model = new Model(models.length, models);
}
if (anIntArray76 != null) {
for (int k1 = 0; k1 < anIntArray76.length; k1++) {
model.recolor(anIntArray76[k1], anIntArray70[k1]);
if (colorSrc != null) {
for (int i = 0; i < colorSrc.length; i++) {
model.recolor(colorSrc[i], colorDst[i]);
}
}
model.createLabelReferences();
model.calculateNormals(64 + anInt85, 850 + anInt92, -30, -50, -30, true);
modelCache.put(uid, model);
}
Model model_1 = Model.EMPTY;
model_1.set(model, SeqFrame.isNull(k) & SeqFrame.isNull(j));
if ((k != -1) && (j != -1)) {
model_1.applySequenceFrames(k, j, ai);
} else if (k != -1) {
model_1.applySequenceFrame(k);
model_1.set(model, SeqFrame.isNull(seqFrame1) & SeqFrame.isNull(seqFrame2));
if ((seqFrame1 != -1) && (seqFrame2 != -1)) {
model_1.applySequenceFrames(seqFrame1, seqFrame2, seqMask);
} else if (seqFrame1 != -1) {
model_1.applySequenceFrame(seqFrame1);
}
if ((anInt91 != 128) || (anInt86 != 128)) {
model_1.scale(anInt91, anInt91, anInt86);
}
model_1.calculateBoundsCylinder();
model_1.labelFaces = null;
model_1.labelVertices = null;
if (size == 1) {
model_1.pickable = true;
}
@@ -217,9 +237,9 @@ public class NPCType {
}
if (i == 1) {
int j = buffer.get1U();
anIntArray94 = new int[j];
modelIds = new int[j];
for (int j1 = 0; j1 < j; j1++) {
anIntArray94[j1] = buffer.get2U();
modelIds[j1] = buffer.get2U();
}
} else if (i == 2) {
name = buffer.getString();
@@ -230,12 +250,12 @@ public class NPCType {
} else if (i == 13) {
seqStand = buffer.get2U();
} else if (i == 14) {
seqWalk = buffer.get2U();
seqWalkId = buffer.get2U();
} else if (i == 17) {
seqWalk = buffer.get2U();
seqTurnAround = buffer.get2U();
seqWalkId = buffer.get2U();
seqTurnAroundId = buffer.get2U();
seqTurnLeft = buffer.get2U();
seqTurnRight = buffer.get2U();
seqTurnRightId = buffer.get2U();
} else if ((i >= 30) && (i < 40)) {
if (op == null) {
op = new String[5];
@@ -246,17 +266,17 @@ public class NPCType {
}
} else if (i == 40) {
int k = buffer.get1U();
anIntArray76 = new int[k];
anIntArray70 = new int[k];
colorSrc = new int[k];
colorDst = new int[k];
for (int k1 = 0; k1 < k; k1++) {
anIntArray76[k1] = buffer.get2U();
anIntArray70[k1] = buffer.get2U();
colorSrc[k1] = buffer.get2U();
colorDst[k1] = buffer.get2U();
}
} else if (i == 60) {
int l = buffer.get1U();
anIntArray73 = new int[l];
headModelIds = new int[l];
for (int l1 = 0; l1 < l; l1++) {
anIntArray73[l1] = buffer.get2U();
headModelIds[l1] = buffer.get2U();
}
} else if (i == 90) {
unusedInt2 = buffer.get2U();
@@ -267,7 +287,7 @@ public class NPCType {
} else if (i == 93) {
aBoolean87 = false;
} else if (i == 95) {
anInt61 = buffer.get2U();
level = buffer.get2U();
} else if (i == 97) {
anInt91 = buffer.get2U();
} else if (i == 98) {
@@ -283,13 +303,13 @@ public class NPCType {
} else if (i == 103) {
turnSpeed = buffer.get2U();
} else if (i == 106) {
varbit = buffer.get2U();
if (varbit == 65535) {
varbit = -1;
varbitId = buffer.get2U();
if (varbitId == 65535) {
varbitId = -1;
}
varp = buffer.get2U();
if (varp == 65535) {
varp = -1;
varpId = buffer.get2U();
if (varpId == 65535) {
varpId = -1;
}
int i1 = buffer.get1U();
overrides = new int[i1 + 1];
+2 -2
View File
@@ -482,7 +482,7 @@ public class ObjType {
return model;
}
public Model getModelUnlit(int amount) {
public Model getUnlitModel(int amount) {
if ((stackId != null) && (amount > 1)) {
int j = -1;
for (int k = 0; k < 10; k++) {
@@ -491,7 +491,7 @@ public class ObjType {
}
}
if (j != -1) {
return get(j).getModelUnlit(1);
return get(j).getUnlitModel(1);
}
}
Model model = Model.tryGet(modelId);
+9 -9
View File
@@ -20,17 +20,17 @@ public class PathingEntity extends Entity {
public int seqStand = -1;
public int seqTurn = -1;
public int chatColor;
public int seqCurrent = -1;
public int seqFrame;
public int seqId2 = -1;
public int seqFrame2;
public int seqCycle;
public int spotanim = -1;
public int spotanimFrame;
public int spotanimCycle;
public int anInt1523;
public int anInt1524;
public int spotanimY;
public int pathRemaining;
public int anInt1526 = -1;
public int anInt1527;
public int seqId1 = -1;
public int seqFrame1;
public int anInt1528;
public int anInt1529;
public int anInt1530;
@@ -64,8 +64,8 @@ public class PathingEntity extends Entity {
}
public void move(int x, int z, boolean teleport) {
if ((anInt1526 != -1) && (SeqType.instances[anInt1526].anInt364 == 1)) {
anInt1526 = -1;
if ((seqId1 != -1) && (SeqType.instances[seqId1].anInt364 == 1)) {
seqId1 = -1;
}
if (!teleport) {
int dx = x - pathTileX[0];
@@ -144,8 +144,8 @@ public class PathingEntity extends Entity {
j++;
k--;
}
if ((anInt1526 != -1) && (SeqType.instances[anInt1526].anInt364 == 1)) {
anInt1526 = -1;
if ((seqId1 != -1) && (SeqType.instances[seqId1].anInt364 == 1)) {
seqId1 = -1;
}
if (pathRemaining < 9) {
pathRemaining++;
+248 -191
View File
@@ -7,25 +7,25 @@ import org.apache.commons.collections4.map.LRUMap;
public class PlayerEntity extends PathingEntity {
public static LRUMap<Long, Model> modelCache = new LRUMap<>(260);
public final int[] anIntArray1700 = new int[5];
public final int[] appearance = new int[12];
public long aLong1697 = -1L;
public NPCType aType_1698;
public boolean aBoolean1699 = false;
public final int[] colors = new int[5];
public final int[] appearances = new int[12];
public long modelUID = -1L;
public NPCType npcType;
public boolean lowmem = false;
public int team;
public int gender;
public String name;
public int combatLevel;
public int headicons;
public int anInt1707;
public int anInt1708;
public int locStartCycle;
public int locStopCycle;
public int y;
public boolean aBoolean1710 = false;
public int anInt1711;
public int anInt1712;
public int anInt1713;
public Model model;
public long aLong1718;
public boolean visible = false;
public int locOffsetX;
public int locOffsetY;
public int locOffsetZ;
public Model locModel;
public long appearanceHashcode;
public int minSceneTileX;
public int minSceneTileZ;
public int maxSceneTileX;
@@ -37,68 +37,79 @@ public class PlayerEntity extends PathingEntity {
@Override
public Model getModel() {
if (!aBoolean1710) {
if (!visible) {
return null;
}
Model model = method452();
Model model = getSequencedModel();
if (model == null) {
return null;
}
super.height = model.minY;
model.pickable = true;
if (aBoolean1699) {
if (lowmem) {
return model;
}
if ((super.spotanim != -1) && (super.spotanimFrame != -1)) {
SpotAnimType type = SpotAnimType.instances[super.spotanim];
Model class30_sub2_sub4_sub6_2 = type.method266();
if (class30_sub2_sub4_sub6_2 != null) {
Model model_3 = new Model(true, SeqFrame.isNull(super.spotanimFrame), false, class30_sub2_sub4_sub6_2);
model_3.translate(0, -super.anInt1524, 0);
model_3.createLabelReferences();
model_3.applySequenceFrame(type.seq.primaryFrames[super.spotanimFrame]);
model_3.labelFaces = null;
model_3.labelVertices = null;
if ((type.anInt410 != 128) || (type.anInt411 != 128)) {
model_3.scale(type.anInt410, type.anInt410, type.anInt411);
SpotAnimType spot = SpotAnimType.instances[super.spotanim];
Model spotModel1 = spot.getModel();
if (spotModel1 != null) {
Model spotModel2 = new Model(true, SeqFrame.isNull(super.spotanimFrame), false, spotModel1);
spotModel2.translate(0, -super.spotanimY, 0);
spotModel2.createLabelReferences();
spotModel2.applySequenceFrame(spot.seq.primaryFrames[super.spotanimFrame]);
spotModel2.labelFaces = null;
spotModel2.labelVertices = null;
if ((spot.scaleXY != 128) || (spot.scaleZ != 128)) {
spotModel2.scale(spot.scaleXY, spot.scaleXY, spot.scaleZ);
}
model_3.calculateNormals(64 + type.anInt413, 850 + type.anInt414, -30, -50, -30, true);
Model[] aclass30_sub2_sub4_sub6_1 = {model, model_3};
model = new Model(2, -819, aclass30_sub2_sub4_sub6_1);
spotModel2.calculateNormals(64 + spot.lightAmbient, 850 + spot.lightAttenuation, -30, -50, -30, true);
model = new Model(2, -819, new Model[]{model, spotModel2});
}
}
if (this.model != null) {
if (Game.loopCycle >= anInt1708) {
this.model = null;
if (this.locModel != null) {
if (Game.loopCycle >= locStopCycle) {
this.locModel = null;
}
if ((Game.loopCycle >= anInt1707) && (Game.loopCycle < anInt1708)) {
Model model_1 = this.model;
model_1.translate(anInt1711 - super.x, anInt1712 - y, anInt1713 - super.z);
if ((Game.loopCycle >= locStartCycle) && (Game.loopCycle < locStopCycle)) {
Model model1 = this.locModel;
model1.translate(locOffsetX - super.x, locOffsetY - y, locOffsetZ - super.z);
if (super.dstYaw == 512) {
model_1.rotateY90();
model_1.rotateY90();
model_1.rotateY90();
model1.rotateY90();
model1.rotateY90();
model1.rotateY90();
} else if (super.dstYaw == 1024) {
model_1.rotateY90();
model_1.rotateY90();
model1.rotateY90();
model1.rotateY90();
} else if (super.dstYaw == 1536) {
model_1.rotateY90();
model1.rotateY90();
}
Model[] aclass30_sub2_sub4_sub6 = {model, model_1};
model = new Model(2, -819, aclass30_sub2_sub4_sub6);
model = new Model(2, -819, new Model[]{model, model1});
if (super.dstYaw == 512) {
model_1.rotateY90();
model1.rotateY90();
} else if (super.dstYaw == 1024) {
model_1.rotateY90();
model_1.rotateY90();
model1.rotateY90();
model1.rotateY90();
} else if (super.dstYaw == 1536) {
model_1.rotateY90();
model_1.rotateY90();
model_1.rotateY90();
model1.rotateY90();
model1.rotateY90();
model1.rotateY90();
}
model_1.translate(super.x - anInt1711, y - anInt1712, super.z - anInt1713);
model1.translate(super.x - locOffsetX, y - locOffsetY, super.z - locOffsetZ);
}
}
model.pickable = true;
return model;
}
@@ -107,34 +118,44 @@ public class PlayerEntity extends PathingEntity {
buffer.position = 0;
gender = buffer.get1U();
headicons = buffer.get1U();
aType_1698 = null;
npcType = null;
team = 0;
for (int j = 0; j < 12; j++) {
int k = buffer.get1U();
if (k == 0) {
appearance[j] = 0;
for (int part = 0; part < 12; part++) {
int msb = buffer.get1U();
if (msb == 0) {
appearances[part] = 0;
continue;
}
int i1 = buffer.get1U();
appearance[j] = (k << 8) + i1;
if ((j == 0) && (appearance[0] == 65535)) {
aType_1698 = NPCType.get(buffer.get2U());
int lsb = buffer.get1U();
appearances[part] = (msb << 8) + lsb;
if ((part == 0) && (appearances[0] == 65535)) {
npcType = NPCType.get(buffer.get2U());
break;
}
if ((appearance[j] >= 512) && ((appearance[j] - 512) < ObjType.count)) {
int l1 = ObjType.get(appearance[j] - 512).team;
if (l1 != 0) {
team = l1;
if ((appearances[part] >= 512) && ((appearances[part] - 512) < ObjType.count)) {
int team = ObjType.get(appearances[part] - 512).team;
if (team != 0) {
this.team = team;
}
}
}
for (int l = 0; l < 5; l++) {
int j1 = buffer.get1U();
if ((j1 < 0) || (j1 >= Game.anIntArrayArray1003[l].length)) {
j1 = 0;
for (int part = 0; part < 5; part++) {
int color = buffer.get1U();
if ((color < 0) || (color >= Game.designPartColor[part].length)) {
color = 0;
}
anIntArray1700[l] = j1;
colors[part] = color;
}
super.seqStand = buffer.get2U();
if (super.seqStand == 65535) {
super.seqStand = -1;
@@ -166,192 +187,228 @@ public class PlayerEntity extends PathingEntity {
name = StringUtil.formatName(StringUtil.fromBase37(buffer.get8()));
combatLevel = buffer.get1U();
skillLevel = buffer.get2U();
aBoolean1710 = true;
aLong1718 = 0L;
for (int k1 = 0; k1 < 12; k1++) {
aLong1718 <<= 4;
if (appearance[k1] >= 256) {
aLong1718 += appearance[k1] - 256;
visible = true;
appearanceHashcode = 0L;
for (int part = 0; part < 12; part++) {
appearanceHashcode <<= 4;
if (appearances[part] >= 256) {
appearanceHashcode += appearances[part] - 256;
}
}
if (appearance[0] >= 256) {
aLong1718 += (appearance[0] - 256) >> 4;
if (appearances[0] >= 256) {
appearanceHashcode += (appearances[0] - 256) >> 4;
}
if (appearance[1] >= 256) {
aLong1718 += (appearance[1] - 256) >> 8;
if (appearances[1] >= 256) {
appearanceHashcode += (appearances[1] - 256) >> 8;
}
for (int i2 = 0; i2 < 5; i2++) {
aLong1718 <<= 3;
aLong1718 += anIntArray1700[i2];
appearanceHashcode <<= 3;
appearanceHashcode += colors[i2];
}
aLong1718 <<= 1;
aLong1718 += gender;
appearanceHashcode <<= 1;
appearanceHashcode += gender;
}
public Model method452() {
if (aType_1698 != null) {
int j = -1;
if ((super.anInt1526 >= 0) && (super.anInt1529 == 0)) {
j = SeqType.instances[super.anInt1526].primaryFrames[super.anInt1527];
} else if (super.seqCurrent >= 0) {
j = SeqType.instances[super.seqCurrent].primaryFrames[super.seqFrame];
public Model getSequencedModel() {
if (npcType != null) {
int frame = -1;
if ((super.seqId1 >= 0) && (super.anInt1529 == 0)) {
frame = SeqType.instances[super.seqId1].primaryFrames[super.seqFrame1];
} else if (super.seqId2 >= 0) {
frame = SeqType.instances[super.seqId2].primaryFrames[super.seqFrame2];
}
return aType_1698.method164(-1, j, null);
}
long l = aLong1718;
int k = -1;
int i1 = -1;
int j1 = -1;
int k1 = -1;
if ((super.anInt1526 >= 0) && (super.anInt1529 == 0)) {
SeqType type = SeqType.instances[super.anInt1526];
k = type.primaryFrames[super.anInt1527];
if ((super.seqCurrent >= 0) && (super.seqCurrent != super.seqStand)) {
i1 = SeqType.instances[super.seqCurrent].primaryFrames[super.seqFrame];
}
if (type.anInt360 >= 0) {
j1 = type.anInt360;
l += ((long) j1 - appearance[5]) << 8;
}
if (type.anInt361 >= 0) {
k1 = type.anInt361;
l += ((long) k1 - appearance[3]) << 16;
}
} else if (super.seqCurrent >= 0) {
k = SeqType.instances[super.seqCurrent].primaryFrames[super.seqFrame];
return npcType.getSequencedModel(-1, frame, null);
}
Model model_1 = modelCache.get(l);
long hashCode = this.appearanceHashcode;
int frame1 = -1;
int frame2 = -1;
int rightHandValue = -1;
int leftHandValue = -1;
if ((super.seqId1 >= 0) && (super.anInt1529 == 0)) {
SeqType type = SeqType.instances[super.seqId1];
frame1 = type.primaryFrames[super.seqFrame1];
if ((super.seqId2 >= 0) && (super.seqId2 != super.seqStand)) {
frame2 = SeqType.instances[super.seqId2].primaryFrames[super.seqFrame2];
}
if (type.rightHandOverride >= 0) {
rightHandValue = type.rightHandOverride;
hashCode += ((long) rightHandValue - appearances[5]) << 8;
}
if (type.leftHandOverride >= 0) {
leftHandValue = type.leftHandOverride;
hashCode += ((long) leftHandValue - appearances[3]) << 16;
}
} else if (super.seqId2 >= 0) {
frame1 = SeqType.instances[super.seqId2].primaryFrames[super.seqFrame2];
}
Model model = modelCache.get(hashCode);
if (model == null) {
boolean invalid = false;
if (model_1 == null) {
boolean flag = false;
for (int part = 0; part < 12; part++) {
int value = appearance[part];
if ((k1 >= 0) && (part == 3)) {
value = k1;
int value = appearances[part];
if ((leftHandValue >= 0) && (part == 3)) {
value = leftHandValue;
}
if ((j1 >= 0) && (part == 5)) {
value = j1;
if ((rightHandValue >= 0) && (part == 5)) {
value = rightHandValue;
}
if ((value >= 256) && (value < 512) && !IDKType.instances[value - 256].method537()) {
flag = true;
if ((value >= 256) && (value < 512) && !IDKType.instances[value - 256].validateModel()) {
invalid = true;
}
if ((value >= 512) && !ObjType.get(value - 512).validateWornModel(gender)) {
flag = true;
invalid = true;
}
}
if (flag) {
if (aLong1697 != -1L) {
model_1 = modelCache.get(aLong1697);
if (invalid) {
if (modelUID != -1L) {
model = modelCache.get(modelUID);
}
if (model_1 == null) {
if (model == null) {
return null;
}
}
}
if (model_1 == null) {
if (model == null) {
Model[] models = new Model[12];
int modelCount = 0;
for (int part = 0; part < 12; part++) {
int value = appearance[part];
if ((k1 >= 0) && (part == 3)) {
value = k1;
int value = appearances[part];
if ((leftHandValue >= 0) && (part == 3)) {
value = leftHandValue;
}
if ((j1 >= 0) && (part == 5)) {
value = j1;
if ((rightHandValue >= 0) && (part == 5)) {
value = rightHandValue;
}
if ((value >= 256) && (value < 512)) {
Model model_3 = IDKType.instances[value - 256].method538();
if (model_3 != null) {
models[modelCount++] = model_3;
Model kitModel = IDKType.instances[value - 256].getModel();
if (kitModel != null) {
models[modelCount++] = kitModel;
}
}
if (value >= 512) {
Model model = ObjType.get(value - 512).getWornModel(gender);
if (model != null) {
models[modelCount++] = model;
Model objModel = ObjType.get(value - 512).getWornModel(gender);
if (objModel != null) {
models[modelCount++] = objModel;
}
}
}
model_1 = new Model(modelCount, models);
for (int j3 = 0; j3 < 5; j3++) {
if (anIntArray1700[j3] != 0) {
model_1.recolor(Game.anIntArrayArray1003[j3][0], Game.anIntArrayArray1003[j3][anIntArray1700[j3]]);
if (j3 == 1) {
model_1.recolor(Game.anIntArray1204[0], Game.anIntArray1204[anIntArray1700[j3]]);
model = new Model(modelCount, models);
for (int part = 0; part < 5; part++) {
if (colors[part] != 0) {
model.recolor(Game.designPartColor[part][0], Game.designPartColor[part][colors[part]]);
if (part == 1) {
model.recolor(Game.designHairColor[0], Game.designHairColor[colors[part]]);
}
}
}
model_1.createLabelReferences();
model_1.calculateNormals(64, 850, -30, -50, -30, true);
modelCache.put(l, model_1);
aLong1697 = l;
model.createLabelReferences();
model.calculateNormals(64, 850, -30, -50, -30, true);
modelCache.put(hashCode, model);
modelUID = hashCode;
}
if (aBoolean1699) {
return model_1;
if (lowmem) {
return model;
}
Model class30_sub2_sub4_sub6_2 = Model.EMPTY;
class30_sub2_sub4_sub6_2.set(model_1, SeqFrame.isNull(k) & SeqFrame.isNull(i1));
if ((k != -1) && (i1 != -1)) {
class30_sub2_sub4_sub6_2.applySequenceFrames(k, i1, SeqType.instances[super.anInt1526].anIntArray357);
} else if (k != -1) {
class30_sub2_sub4_sub6_2.applySequenceFrame(k);
Model animated = Model.EMPTY;
animated.set(model, SeqFrame.isNull(frame1) & SeqFrame.isNull(frame2));
if ((frame1 != -1) && (frame2 != -1)) {
animated.applySequenceFrames(frame1, frame2, SeqType.instances[super.seqId1].anIntArray357);
} else if (frame1 != -1) {
animated.applySequenceFrame(frame1);
}
class30_sub2_sub4_sub6_2.calculateBoundsCylinder();
class30_sub2_sub4_sub6_2.labelFaces = null;
class30_sub2_sub4_sub6_2.labelVertices = null;
return class30_sub2_sub4_sub6_2;
animated.calculateBoundsCylinder();
animated.labelFaces = null;
animated.labelVertices = null;
return animated;
}
@Override
public boolean isVisible() {
return aBoolean1710;
return visible;
}
public Model method453() {
if (!aBoolean1710) {
public Model getUnlitHeadModel() {
if (!visible) {
return null;
}
if (aType_1698 != null) {
return aType_1698.method160();
if (npcType != null) {
return npcType.getUnlitHeadModel();
}
boolean flag = false;
for (int i = 0; i < 12; i++) {
int j = appearance[i];
if ((j >= 256) && (j < 512) && !IDKType.instances[j - 256].method539()) {
flag = true;
boolean invalid = false;
for (int part = 0; part < 12; part++) {
int value = appearances[part];
if ((value >= 256) && (value < 512) && !IDKType.instances[value - 256].validateHeadModel()) {
invalid = true;
}
if ((j >= 512) && !ObjType.get(j - 512).validateHeadModel(gender)) {
flag = true;
if ((value >= 512) && !ObjType.get(value - 512).validateHeadModel(gender)) {
invalid = true;
}
}
if (flag) {
if (invalid) {
return null;
}
Model[] aclass30_sub2_sub4_sub6 = new Model[12];
int k = 0;
for (int l = 0; l < 12; l++) {
int i1 = appearance[l];
if ((i1 >= 256) && (i1 < 512)) {
Model model_1 = IDKType.instances[i1 - 256].method540();
if (model_1 != null) {
aclass30_sub2_sub4_sub6[k++] = model_1;
Model[] models = new Model[12];
int modelCount = 0;
for (int part = 0; part < 12; part++) {
int value = appearances[part];
if ((value >= 256) && (value < 512)) {
Model model = IDKType.instances[value - 256].method540();
if (model != null) {
models[modelCount++] = model;
}
}
if (i1 >= 512) {
Model class30_sub2_sub4_sub6_2 = ObjType.get(i1 - 512).getHeadModel(gender);
if (class30_sub2_sub4_sub6_2 != null) {
aclass30_sub2_sub4_sub6[k++] = class30_sub2_sub4_sub6_2;
if (value >= 512) {
Model model = ObjType.get(value - 512).getHeadModel(gender);
if (model != null) {
models[modelCount++] = model;
}
}
}
Model model = new Model(k, aclass30_sub2_sub4_sub6);
Model model = new Model(modelCount, models);
for (int j1 = 0; j1 < 5; j1++) {
if (anIntArray1700[j1] != 0) {
model.recolor(Game.anIntArrayArray1003[j1][0], Game.anIntArrayArray1003[j1][anIntArray1700[j1]]);
if (colors[j1] != 0) {
model.recolor(Game.designPartColor[j1][0], Game.designPartColor[j1][colors[j1]]);
if (j1 == 1) {
model.recolor(Game.anIntArray1204[0], Game.anIntArray1204[anIntArray1700[j1]]);
model.recolor(Game.designHairColor[0], Game.designHairColor[colors[j1]]);
}
}
}
+4 -4
View File
@@ -64,7 +64,7 @@ public class ProjectileEntity extends Entity {
@Override
public Model getModel() {
Model model = aType_1592.method266();
Model model = aType_1592.getModel();
if (model == null) {
return null;
}
@@ -79,11 +79,11 @@ public class ProjectileEntity extends Entity {
model_1.labelFaces = null;
model_1.labelVertices = null;
}
if ((aType_1592.anInt410 != 128) || (aType_1592.anInt411 != 128)) {
model_1.scale(aType_1592.anInt410, aType_1592.anInt410, aType_1592.anInt411);
if ((aType_1592.scaleXY != 128) || (aType_1592.scaleZ != 128)) {
model_1.scale(aType_1592.scaleXY, aType_1592.scaleXY, aType_1592.scaleZ);
}
model_1.rotateX(anInt1596);
model_1.calculateNormals(64 + aType_1592.anInt413, 850 + aType_1592.anInt414, -30, -50, -30, true);
model_1.calculateNormals(64 + aType_1592.lightAmbient, 850 + aType_1592.lightAttenuation, -30, -50, -30, true);
return model_1;
}
+1 -1
View File
@@ -250,7 +250,7 @@ public class Scene {
}
}
public void method279(int plane, int stx, int stz, int type, int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, int i3, int j3, int k3, int l3, int i4, int j4, int k4, int l4) {
public void setTile(int plane, int stx, int stz, int type, int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, int i3, int j3, int k3, int l3, int i4, int j4, int k4, int l4) {
if (type == 0) {
SceneTileUnderlay underlay = new SceneTileUnderlay(k2, l2, i3, j3, -1, k4, false);
for (int p = plane; p >= 0; p--) {
+224 -177
View File
@@ -22,7 +22,7 @@ public class SceneBuilder {
}
public static int method172(int i, int i_108_) {
int i_109_ = ((method176(i + 45365, i_108_ + 91923, 4) - 128) + ((method176(i + 10294, i_108_ + 37821, 2) - 128) >> 1) + ((method176(i, i_108_, 1) - 128) >> 2));
int i_109_ = (method176(i + 45365, i_108_ + 91923, 4) - 128) + ((method176(i + 10294, i_108_ + 37821, 2) - 128) >> 1) + ((method176(i, i_108_, 1) - 128) >> 2);
i_109_ = (int) ((double) i_109_ * 0.3) + 35;
if (i_109_ < 10) {
i_109_ = 10;
@@ -85,28 +85,29 @@ public class SceneBuilder {
}
public static int method184(int i, int i_216_, int i_217_, int i_218_) {
int i_219_ = ((65536 - Draw3D.cos[(i_217_ * 1024) / i_218_]) >> 1);
int i_219_ = (65536 - Draw3D.cos[(i_217_ * 1024) / i_218_]) >> 1;
return ((i * (65536 - i_219_)) >> 16) + ((i_216_ * i_219_) >> 16);
}
public static int method186(int i, int i_221_) {
int i_222_ = (method170(i - 1, i_221_ - 1) + method170(i + 1, i_221_ - 1) + method170(i - 1, i_221_ + 1) + method170(i + 1, i_221_ + 1));
int i_223_ = (method170(i - 1, i_221_) + method170(i + 1, i_221_) + method170(i, i_221_ - 1) + method170(i, i_221_ + 1));
int i_222_ = method170(i - 1, i_221_ - 1) + method170(i + 1, i_221_ - 1) + method170(i - 1, i_221_ + 1) + method170(i + 1, i_221_ + 1);
int i_223_ = method170(i - 1, i_221_) + method170(i + 1, i_221_) + method170(i, i_221_ - 1) + method170(i, i_221_ + 1);
int i_224_ = method170(i, i_221_);
return (i_222_ / 16) + (i_223_ / 8) + (i_224_ / 4);
}
public static int method187(int i, int i_225_) {
if (i == -1) {
public static int mulHSL(int hsl, int lightness) {
if (hsl == -1) {
return 12345678;
}
i_225_ = (i_225_ * (i & 0x7f)) / 128;
if (i_225_ < 2) {
i_225_ = 2;
} else if (i_225_ > 126) {
i_225_ = 126;
lightness = (lightness * (hsl & 0x7f)) / 128;
if (lightness < 2) {
lightness = 2;
} else if (lightness > 126) {
lightness = 126;
}
return (i & 0xff80) + i_225_;
return (hsl & 0xff80) + lightness;
}
public static void addLoc(Scene scene, int rotation, int z, int kind, int plane, SceneCollisionMap collision, int[][][] planeHeightmap, int x, int locID, int dataPlane) {
@@ -396,7 +397,7 @@ public class SceneBuilder {
public final byte[][][] planeShademap;
public final int[][][] planeOccludemap;
public final byte[][][] aByteArrayArrayArray136;
public final int[][] anIntArrayArray139;
public final int[][] planeTileLightness;
public final byte[][][] aByteArrayArrayArray142;
public final int maxTileX;
public final int maxTileZ;
@@ -415,7 +416,7 @@ public class SceneBuilder {
aByteArrayArrayArray148 = new byte[4][this.maxTileX][this.maxTileZ];
planeOccludemap = new int[4][this.maxTileX + 1][this.maxTileZ + 1];
planeShademap = new byte[4][this.maxTileX + 1][this.maxTileZ + 1];
anIntArrayArray139 = new int[this.maxTileX + 1][this.maxTileZ + 1];
planeTileLightness = new int[this.maxTileX + 1][this.maxTileZ + 1];
anIntArray124 = new int[this.maxTileZ];
anIntArray125 = new int[this.maxTileZ];
anIntArray126 = new int[this.maxTileZ];
@@ -423,203 +424,245 @@ public class SceneBuilder {
anIntArray128 = new int[this.maxTileZ];
}
public void method171(SceneCollisionMap[] collisionMaps, Scene scene) {
for (int i_6_ = 0; i_6_ < 4; i_6_++) {
for (int i_7_ = 0; i_7_ < 104; i_7_++) {
for (int i_8_ = 0; i_8_ < 104; i_8_++) {
if ((planeTileFlags[i_6_][i_7_][i_8_] & 0x1) == 1) {
int i_9_ = i_6_;
if ((planeTileFlags[1][i_7_][i_8_] & 0x2) == 2) {
i_9_--;
public void method171(SceneCollisionMap[] planeCollisions, Scene scene) {
for (int plane = 0; plane < 4; plane++) {
for (int x = 0; x < 104; x++) {
for (int z = 0; z < 104; z++) {
if ((planeTileFlags[plane][x][z] & 0x1) == 1) {
int physicalPlane = plane;
// bridge
if ((planeTileFlags[1][x][z] & 0x2) == 2) {
physicalPlane--;
}
if (i_9_ >= 0) {
collisionMaps[i_9_].addSolid(i_8_, i_7_);
if (physicalPlane >= 0) {
planeCollisions[physicalPlane].addSolid(z, x);
}
}
}
}
}
anInt123 += (int) (Math.random() * 5.0) - 2;
if (anInt123 < -8) {
anInt123 = -8;
}
if (anInt123 > 8) {
anInt123 = 8;
}
anInt133 += (int) (Math.random() * 5.0) - 2;
if (anInt133 < -16) {
anInt133 = -16;
}
if (anInt133 > 16) {
anInt133 = 16;
}
for (int plane = 0; plane < 4; plane++) {
byte[][] is = planeShademap[plane];
int i_11_ = 96;
int i_12_ = 768;
int i_13_ = -50;
int i_14_ = -10;
int i_15_ = -50;
int i_16_ = (int) Math.sqrt((i_13_ * i_13_) + (i_14_ * i_14_) + (i_15_ * i_15_));
int i_17_ = (i_12_ * i_16_) >> 8;
for (int i_18_ = 1; i_18_ < (maxTileZ - 1); i_18_++) {
for (int i_19_ = 1; i_19_ < (maxTileX - 1); i_19_++) {
int i_20_ = (planeHeightmap[plane][i_19_ + 1][i_18_] - planeHeightmap[plane][i_19_ - 1][i_18_]);
int i_21_ = (planeHeightmap[plane][i_19_][i_18_ + 1] - planeHeightmap[plane][i_19_][i_18_ - 1]);
int i_22_ = (int) Math.sqrt((i_20_ * i_20_) + 65536 + (i_21_ * i_21_));
int i_23_ = (i_20_ << 8) / i_22_;
int i_24_ = 65536 / i_22_;
int i_25_ = (i_21_ << 8) / i_22_;
int i_26_ = i_11_ + (((i_13_ * i_23_) + (i_14_ * i_24_) + (i_15_ * i_25_)) / i_17_);
int i_27_ = ((is[i_19_ - 1][i_18_] >> 2) + (is[i_19_ + 1][i_18_] >> 3) + (is[i_19_][i_18_ - 1] >> 2) + (is[i_19_][i_18_ + 1] >> 3) + (is[i_19_][i_18_] >> 1));
anIntArrayArray139[i_19_][i_18_] = i_26_ - i_27_;
byte[][] shademap = planeShademap[plane];
int lightAmbient = 96;
int lightAttenuation = 768;
int lightX = -50;
int lightY = -10;
int lightZ = -50;
int lightMagnitude = (lightAttenuation * (int) Math.sqrt((lightX * lightX) + (lightY * lightY) + (lightZ * lightZ))) >> 8;
for (int z = 1; z < (maxTileZ - 1); z++) {
for (int x = 1; x < (maxTileX - 1); x++) {
int dx = planeHeightmap[plane][x + 1][z] - planeHeightmap[plane][x - 1][z];
int dz = planeHeightmap[plane][x][z + 1] - planeHeightmap[plane][x][z - 1];
int len = (int) Math.sqrt((dx * dx) + 65536 + (dz * dz));
int nx = (dx << 8) / len;
int ny = 65536 / len;
int nz = (dz << 8) / len;
int light = lightAmbient + (((lightX * nx) + (lightY * ny) + (lightZ * nz)) / lightMagnitude);
int shade = (shademap[x - 1][z] >> 2) + (shademap[x + 1][z] >> 3) + (shademap[x][z - 1] >> 2) + (shademap[x][z + 1] >> 3) + (shademap[x][z] >> 1);
planeTileLightness[x][z] = light - shade;
}
}
for (int i_28_ = 0; i_28_ < maxTileZ; i_28_++) {
anIntArray124[i_28_] = 0;
anIntArray125[i_28_] = 0;
anIntArray126[i_28_] = 0;
anIntArray127[i_28_] = 0;
anIntArray128[i_28_] = 0;
for (int z = 0; z < maxTileZ; z++) {
anIntArray124[z] = 0;
anIntArray125[z] = 0;
anIntArray126[z] = 0;
anIntArray127[z] = 0;
anIntArray128[z] = 0;
}
for (int i_29_ = -5; i_29_ < (maxTileX + 5); i_29_++) {
for (int i_30_ = 0; i_30_ < maxTileZ; i_30_++) {
int i_31_ = i_29_ + 5;
if ((i_31_ >= 0) && (i_31_ < maxTileX)) {
int i_32_ = aByteArrayArrayArray142[plane][i_31_][i_30_] & 0xff;
if (i_32_ > 0) {
FloType type = FloType.instances[i_32_ - 1];
anIntArray124[i_30_] += type.anInt397;
anIntArray125[i_30_] += type.anInt395;
anIntArray126[i_30_] += type.anInt396;
anIntArray127[i_30_] += type.anInt398;
anIntArray128[i_30_]++;
for (int x0 = -5; x0 < (maxTileX + 5); x0++) {
for (int z0 = 0; z0 < maxTileZ; z0++) {
int x1 = x0 + 5;
if ((x1 >= 0) && (x1 < maxTileX)) {
int floId = aByteArrayArrayArray142[plane][x1][z0] & 0xff;
if (floId > 0) {
FloType flo = FloType.instances[floId - 1];
anIntArray124[z0] += flo.chroma;
anIntArray125[z0] += flo.saturation;
anIntArray126[z0] += flo.lightness;
anIntArray127[z0] += flo.luminance;
anIntArray128[z0]++;
}
}
int i_33_ = i_29_ - 5;
if ((i_33_ >= 0) && (i_33_ < maxTileX)) {
int i_34_ = aByteArrayArrayArray142[plane][i_33_][i_30_] & 0xff;
if (i_34_ > 0) {
FloType type = FloType.instances[i_34_ - 1];
anIntArray124[i_30_] -= type.anInt397;
anIntArray125[i_30_] -= type.anInt395;
anIntArray126[i_30_] -= type.anInt396;
anIntArray127[i_30_] -= type.anInt398;
anIntArray128[i_30_]--;
int x2 = x0 - 5;
if ((x2 >= 0) && (x2 < maxTileX)) {
int floId = aByteArrayArrayArray142[plane][x2][z0] & 0xff;
if (floId > 0) {
FloType flo = FloType.instances[floId - 1];
anIntArray124[z0] -= flo.chroma;
anIntArray125[z0] -= flo.saturation;
anIntArray126[z0] -= flo.lightness;
anIntArray127[z0] -= flo.luminance;
anIntArray128[z0]--;
}
}
}
if ((i_29_ >= 1) && (i_29_ < (maxTileX - 1))) {
if ((x0 >= 1) && (x0 < (maxTileX - 1))) {
int i_35_ = 0;
int i_36_ = 0;
int i_37_ = 0;
int i_38_ = 0;
int i_39_ = 0;
for (int i_40_ = -5; i_40_ < (maxTileZ + 5); i_40_++) {
int i_41_ = i_40_ + 5;
if ((i_41_ >= 0) && (i_41_ < maxTileZ)) {
i_35_ += anIntArray124[i_41_];
i_36_ += anIntArray125[i_41_];
i_37_ += anIntArray126[i_41_];
i_38_ += anIntArray127[i_41_];
i_39_ += anIntArray128[i_41_];
for (int z0 = -5; z0 < (maxTileZ + 5); z0++) {
int dz1 = z0 + 5;
if ((dz1 >= 0) && (dz1 < maxTileZ)) {
i_35_ += anIntArray124[dz1];
i_36_ += anIntArray125[dz1];
i_37_ += anIntArray126[dz1];
i_38_ += anIntArray127[dz1];
i_39_ += anIntArray128[dz1];
}
int i_42_ = i_40_ - 5;
if ((i_42_ >= 0) && (i_42_ < maxTileZ)) {
i_35_ -= anIntArray124[i_42_];
i_36_ -= anIntArray125[i_42_];
i_37_ -= anIntArray126[i_42_];
i_38_ -= anIntArray127[i_42_];
i_39_ -= anIntArray128[i_42_];
int dz2 = z0 - 5;
if ((dz2 >= 0) && (dz2 < maxTileZ)) {
i_35_ -= anIntArray124[dz2];
i_36_ -= anIntArray125[dz2];
i_37_ -= anIntArray126[dz2];
i_38_ -= anIntArray127[dz2];
i_39_ -= anIntArray128[dz2];
}
if ((i_40_ >= 1) && (i_40_ < (maxTileZ - 1)) && (!lowmem || ((planeTileFlags[0][i_29_][i_40_] & 0x2) != 0) || (((planeTileFlags[plane][i_29_][i_40_] & 0x10) == 0) && (getDrawPlane(plane, i_29_, i_40_) == anInt131)))) {
if ((z0 >= 1) && (z0 < (maxTileZ - 1)) && (!lowmem || ((planeTileFlags[0][x0][z0] & 0x2) != 0) || (((planeTileFlags[plane][x0][z0] & 0x10) == 0) && (getDrawPlane(plane, x0, z0) == anInt131)))) {
if (plane < minPlane) {
minPlane = plane;
}
int i_43_ = (aByteArrayArrayArray142[plane][i_29_][i_40_] & 0xff);
int i_44_ = (aByteArrayArrayArray130[plane][i_29_][i_40_] & 0xff);
if ((i_43_ > 0) || (i_44_ > 0)) {
int i_45_ = planeHeightmap[plane][i_29_][i_40_];
int i_46_ = (planeHeightmap[plane][i_29_ + 1][i_40_]);
int i_47_ = (planeHeightmap[plane][i_29_ + 1][i_40_ + 1]);
int i_48_ = (planeHeightmap[plane][i_29_][i_40_ + 1]);
int i_49_ = anIntArrayArray139[i_29_][i_40_];
int i_50_ = anIntArrayArray139[i_29_ + 1][i_40_];
int i_51_ = anIntArrayArray139[i_29_ + 1][i_40_ + 1];
int i_52_ = anIntArrayArray139[i_29_][i_40_ + 1];
int i_43_ = aByteArrayArrayArray142[plane][x0][z0] & 0xff;
int floId = aByteArrayArrayArray130[plane][x0][z0] & 0xff;
if ((i_43_ > 0) || (floId > 0)) {
int heightSW = planeHeightmap[plane][x0][z0];
int heightSE = planeHeightmap[plane][x0 + 1][z0];
int heightNE = planeHeightmap[plane][x0 + 1][z0 + 1];
int heightNW = planeHeightmap[plane][x0][z0 + 1];
int tileHeight00 = planeTileLightness[x0][z0];
int tileHeight10 = planeTileLightness[x0 + 1][z0];
int tileHeight11 = planeTileLightness[x0 + 1][z0 + 1];
int tileHeight01 = planeTileLightness[x0][z0 + 1];
int i_53_ = -1;
int i_54_ = -1;
if (i_43_ > 0) {
int i_55_ = (i_35_ * 256) / i_38_;
int i_56_ = i_36_ / i_39_;
int i_57_ = i_37_ / i_39_;
i_53_ = method177(i_55_, i_56_, i_57_);
i_55_ = (i_55_ + anInt123) & 0xff;
i_57_ += anInt133;
if (i_57_ < 0) {
i_57_ = 0;
} else if (i_57_ > 255) {
i_57_ = 255;
int hue = (i_35_ * 256) / i_38_;
int saturation = i_36_ / i_39_;
int lightness = i_37_ / i_39_;
i_53_ = decimateHSL(hue, saturation, lightness);
hue = (hue + anInt123) & 0xff;
lightness += anInt133;
if (lightness < 0) {
lightness = 0;
} else if (lightness > 255) {
lightness = 255;
}
i_54_ = method177(i_55_, i_56_, i_57_);
i_54_ = decimateHSL(hue, saturation, lightness);
}
if (plane > 0) {
boolean bool = true;
if ((i_43_ == 0) && ((aByteArrayArrayArray136[plane][i_29_][i_40_]) != 0)) {
if ((i_43_ == 0) && (aByteArrayArrayArray136[plane][x0][z0] != 0)) {
bool = false;
}
if ((i_44_ > 0) && !(FloType.instances[i_44_ - 1].aBoolean393)) {
if ((floId > 0) && !FloType.instances[floId - 1].aBoolean393) {
bool = false;
}
if (bool && (i_45_ == i_46_) && (i_45_ == i_47_) && (i_45_ == i_48_)) {
planeOccludemap[plane][i_29_][i_40_] |= 0x924;
if (bool && (heightSW == heightSE) && (heightSW == heightNE) && (heightSW == heightNW)) {
planeOccludemap[plane][x0][z0] |= 0x924;
}
}
int i_58_ = 0;
if (i_53_ != -1) {
i_58_ = (Draw3D.palette[method187(i_54_, 96)]);
i_58_ = Draw3D.palette[mulHSL(i_54_, 96)];
}
if (i_44_ == 0) {
scene.method279(plane, i_29_, i_40_, 0, 0, -1, i_45_, i_46_, i_47_, i_48_, method187(i_53_, i_49_), method187(i_53_, i_50_), method187(i_53_, i_51_), method187(i_53_, i_52_), 0, 0, 0, 0, i_58_, 0);
if (floId == 0) {
scene.setTile(plane, x0, z0, 0, 0, -1, heightSW, heightSE, heightNE, heightNW, mulHSL(i_53_, tileHeight00), mulHSL(i_53_, tileHeight10), mulHSL(i_53_, tileHeight11), mulHSL(i_53_, tileHeight01), 0, 0, 0, 0, i_58_, 0);
} else {
int i_59_ = ((aByteArrayArrayArray136[plane][i_29_][i_40_]) + 1);
byte i_60_ = (aByteArrayArrayArray148[plane][i_29_][i_40_]);
FloType type = FloType.instances[i_44_ - 1];
int textureId = type.textureId;
int i_62_;
int i_63_;
int i_59_ = aByteArrayArrayArray136[plane][x0][z0] + 1;
byte i_60_ = aByteArrayArrayArray148[plane][x0][z0];
FloType flo = FloType.instances[floId - 1];
int textureId = flo.textureId;
int rgb;
int hsl;
if (textureId >= 0) {
i_62_ = Draw3D.getAverageTextureRGB(textureId);
i_63_ = -1;
} else if (type.anInt390 == 16711935) {
i_62_ = 0;
i_63_ = -2;
rgb = Draw3D.getAverageTextureRGB(textureId);
hsl = -1;
} else if (flo.rgb == 16711935) {
rgb = 0;
hsl = -2;
textureId = -1;
} else {
i_63_ = method177(type.anInt394, type.anInt395, type.anInt396);
i_62_ = (Draw3D.palette[method185(type.anInt399, 96)]);
hsl = decimateHSL(flo.hue, flo.saturation, flo.lightness);
rgb = Draw3D.palette[adjustLightness(flo.hsl, 96)];
}
scene.method279(plane, i_29_, i_40_, i_59_, i_60_, textureId, i_45_, i_46_, i_47_, i_48_, method187(i_53_, i_49_), method187(i_53_, i_50_), method187(i_53_, i_51_), method187(i_53_, i_52_), method185(i_63_, i_49_), method185(i_63_, i_50_), method185(i_63_, i_51_), method185(i_63_, i_52_), i_58_, i_62_);
scene.setTile(plane, x0, z0, i_59_, i_60_, textureId, heightSW, heightSE, heightNE, heightNW, mulHSL(i_53_, tileHeight00), mulHSL(i_53_, tileHeight10), mulHSL(i_53_, tileHeight11), mulHSL(i_53_, tileHeight01), adjustLightness(hsl, tileHeight00), adjustLightness(hsl, tileHeight10), adjustLightness(hsl, tileHeight11), adjustLightness(hsl, tileHeight01), i_58_, rgb);
}
}
}
}
}
}
for (int stz = 1; stz < (maxTileZ - 1); stz++) {
for (int stx = 1; stx < (maxTileX - 1); stx++) {
scene.setDrawPlane(plane, stx, stz, getDrawPlane(plane, stx, stz));
}
}
}
scene.method305(-10, 64, -50, 768, -50);
for (int i_66_ = 0; i_66_ < maxTileX; i_66_++) {
for (int i_67_ = 0; i_67_ < maxTileZ; i_67_++) {
if ((planeTileFlags[1][i_66_][i_67_] & 0x2) == 2) {
scene.setBridge(i_66_, i_67_);
for (int x = 0; x < maxTileX; x++) {
for (int z = 0; z < maxTileZ; z++) {
if ((planeTileFlags[1][x][z] & 0x2) == 2) {
scene.setBridge(x, z);
}
}
}
int i_68_ = 1;
int i_69_ = 2;
int i_70_ = 4;
@@ -638,19 +681,19 @@ public class SceneBuilder {
int i_77_ = plane;
int i_78_ = plane;
for (/**/; i_75_ > 0; i_75_--) {
if (((planeOccludemap[plane][x][i_75_ - 1]) & i_68_) == 0) {
if ((planeOccludemap[plane][x][i_75_ - 1] & i_68_) == 0) {
break;
}
}
for (/**/; i_76_ < maxTileZ; i_76_++) {
if (((planeOccludemap[plane][x][i_76_ + 1]) & i_68_) == 0) {
if ((planeOccludemap[plane][x][i_76_ + 1] & i_68_) == 0) {
break;
}
}
while_0_:
for (/**/; i_77_ > 0; i_77_--) {
for (int i_79_ = i_75_; i_79_ <= i_76_; i_79_++) {
if (((planeOccludemap[i_77_ - 1][x][i_79_]) & i_68_) == 0) {
if ((planeOccludemap[i_77_ - 1][x][i_79_] & i_68_) == 0) {
break while_0_;
}
}
@@ -658,7 +701,7 @@ public class SceneBuilder {
while_1_:
for (/**/; i_78_ < i_71_; i_78_++) {
for (int i_80_ = i_75_; i_80_ <= i_76_; i_80_++) {
if (((planeOccludemap[i_78_ + 1][x][i_80_]) & i_68_) == 0) {
if ((planeOccludemap[i_78_ + 1][x][i_80_] & i_68_) == 0) {
break while_1_;
}
}
@@ -666,7 +709,7 @@ public class SceneBuilder {
int i_81_ = ((i_78_ + 1) - i_77_) * ((i_76_ - i_75_) + 1);
if (i_81_ >= 8) {
int i_82_ = 240;
int i_83_ = (planeHeightmap[i_78_][x][i_75_] - i_82_);
int i_83_ = planeHeightmap[i_78_][x][i_75_] - i_82_;
int i_84_ = planeHeightmap[i_77_][x][i_75_];
Scene.method277(i_71_, x * 128, i_84_, x * 128, (i_76_ * 128) + 128, i_83_, i_75_ * 128, 1);
for (int i_85_ = i_77_; i_85_ <= i_78_; i_85_++) {
@@ -682,19 +725,19 @@ public class SceneBuilder {
int i_89_ = plane;
int i_90_ = plane;
for (/**/; i_87_ > 0; i_87_--) {
if (((planeOccludemap[plane][i_87_ - 1][z]) & i_69_) == 0) {
if ((planeOccludemap[plane][i_87_ - 1][z] & i_69_) == 0) {
break;
}
}
for (/**/; i_88_ < maxTileX; i_88_++) {
if (((planeOccludemap[plane][i_88_ + 1][z]) & i_69_) == 0) {
if ((planeOccludemap[plane][i_88_ + 1][z] & i_69_) == 0) {
break;
}
}
while_2_:
for (/**/; i_89_ > 0; i_89_--) {
for (int i_91_ = i_87_; i_91_ <= i_88_; i_91_++) {
if (((planeOccludemap[i_89_ - 1][i_91_][z]) & i_69_) == 0) {
if ((planeOccludemap[i_89_ - 1][i_91_][z] & i_69_) == 0) {
break while_2_;
}
}
@@ -702,7 +745,7 @@ public class SceneBuilder {
while_3_:
for (/**/; i_90_ < i_71_; i_90_++) {
for (int i_92_ = i_87_; i_92_ <= i_88_; i_92_++) {
if (((planeOccludemap[i_90_ + 1][i_92_][z]) & i_69_) == 0) {
if ((planeOccludemap[i_90_ + 1][i_92_][z] & i_69_) == 0) {
break while_3_;
}
}
@@ -710,7 +753,7 @@ public class SceneBuilder {
int i_93_ = ((i_90_ + 1) - i_89_) * ((i_88_ - i_87_) + 1);
if (i_93_ >= 8) {
int i_94_ = 240;
int i_95_ = (planeHeightmap[i_90_][i_87_][z] - i_94_);
int i_95_ = planeHeightmap[i_90_][i_87_][z] - i_94_;
int i_96_ = planeHeightmap[i_89_][i_87_][z];
Scene.method277(i_71_, i_87_ * 128, i_96_, (i_88_ * 128) + 128, z * 128, i_95_, z * 128, 2);
for (int i_97_ = i_89_; i_97_ <= i_90_; i_97_++) {
@@ -726,19 +769,19 @@ public class SceneBuilder {
int i_101_ = z;
int i_102_ = z;
for (/**/; i_101_ > 0; i_101_--) {
if (((planeOccludemap[plane][x][i_101_ - 1]) & i_70_) == 0) {
if ((planeOccludemap[plane][x][i_101_ - 1] & i_70_) == 0) {
break;
}
}
for (/**/; i_102_ < maxTileZ; i_102_++) {
if (((planeOccludemap[plane][x][i_102_ + 1]) & i_70_) == 0) {
if ((planeOccludemap[plane][x][i_102_ + 1] & i_70_) == 0) {
break;
}
}
while_4_:
for (/**/; i_99_ > 0; i_99_--) {
for (int i_103_ = i_101_; i_103_ <= i_102_; i_103_++) {
if (((planeOccludemap[plane][i_99_ - 1][i_103_]) & i_70_) == 0) {
if ((planeOccludemap[plane][i_99_ - 1][i_103_] & i_70_) == 0) {
break while_4_;
}
}
@@ -746,7 +789,7 @@ public class SceneBuilder {
while_5_:
for (/**/; i_100_ < maxTileX; i_100_++) {
for (int i_104_ = i_101_; i_104_ <= i_102_; i_104_++) {
if (((planeOccludemap[plane][i_100_ + 1][i_104_]) & i_70_) == 0) {
if ((planeOccludemap[plane][i_100_ + 1][i_104_] & i_70_) == 0) {
break while_5_;
}
}
@@ -871,7 +914,7 @@ public class SceneBuilder {
shade = 30;
}
if (shade > (planeShademap[plane][x + dx][z + dz])) {
if (shade > planeShademap[plane][x + dx][z + dz]) {
planeShademap[plane][x + dx][z + dz] = (byte) shade;
}
}
@@ -1117,27 +1160,27 @@ public class SceneBuilder {
}
}
public int method177(int i, int i_156_, int i_157_) {
if (i_157_ > 179) {
i_156_ /= 2;
public int decimateHSL(int hue, int saturation, int lightness) {
if (lightness > 179) {
saturation /= 2;
}
if (i_157_ > 192) {
i_156_ /= 2;
if (lightness > 192) {
saturation /= 2;
}
if (i_157_ > 217) {
i_156_ /= 2;
if (lightness > 217) {
saturation /= 2;
}
if (i_157_ > 243) {
i_156_ /= 2;
if (lightness > 243) {
saturation /= 2;
}
return ((i / 4) << 10) + ((i_156_ / 32) << 7) + (i_157_ / 2);
return ((hue / 4) << 10) + ((saturation / 32) << 7) + (lightness / 2);
}
public void method179(int i, int i_162_, SceneCollisionMap[] collisionMaps, int i_164_, int i_165_, byte[] is, int i_166_, int i_167_, int i_168_) {
for (int i_169_ = 0; i_169_ < 8; i_169_++) {
for (int i_170_ = 0; i_170_ < 8; i_170_++) {
if (((i_164_ + i_169_) > 0) && ((i_164_ + i_169_) < 103) && ((i_168_ + i_170_) > 0) && ((i_168_ + i_170_) < 103)) {
collisionMaps[i_167_].flags[i_164_ + i_169_][(i_168_ + i_170_)] &= ~0x1000000;
collisionMaps[i_167_].flags[i_164_ + i_169_][i_168_ + i_170_] &= ~0x1000000;
}
}
}
@@ -1197,7 +1240,7 @@ public class SceneBuilder {
if (i_187_ == 0) {
planeHeightmap[0][i_186_][i] = -i_192_ * 8;
} else {
planeHeightmap[i_187_][i_186_][i] = (planeHeightmap[i_187_ - 1][i_186_][i] - (i_192_ * 8));
planeHeightmap[i_187_][i_186_][i] = planeHeightmap[i_187_ - 1][i_186_][i] - (i_192_ * 8);
break;
}
break;
@@ -1281,26 +1324,30 @@ public class SceneBuilder {
}
}
public int method185(int i, int i_220_) {
if (i == -2) {
public int adjustLightness(int hsl, int scalar) {
if (hsl == -2) {
return 12345678;
}
if (i == -1) {
if (i_220_ < 0) {
i_220_ = 0;
} else if (i_220_ > 127) {
i_220_ = 127;
if (hsl == -1) {
if (scalar < 0) {
scalar = 0;
} else if (scalar > 127) {
scalar = 127;
}
i_220_ = 127 - i_220_;
return i_220_;
scalar = 127 - scalar;
return scalar;
}
i_220_ = (i_220_ * (i & 0x7f)) / 128;
if (i_220_ < 2) {
i_220_ = 2;
} else if (i_220_ > 126) {
i_220_ = 126;
scalar = (scalar * (hsl & 0x7f)) / 128;
if (scalar < 2) {
scalar = 2;
} else if (scalar > 126) {
scalar = 126;
}
return (i & 0xff80) + i_220_;
return (hsl & 0xff80) + scalar;
}
public void method190(int i, SceneCollisionMap[] collisionMaps, int i_263_, Scene scene, byte[] is) {
+2 -2
View File
@@ -9,10 +9,10 @@ public class SceneLocTemporary extends DoublyLinkedList.Node {
public int anInt1293;
public int anInt1294;
public int plane;
public int classID;
public int classId;
public int localX;
public int localZ;
public int savedLocID;
public int savedLocId;
public int savedRotation;
public int savedKind;
public int anInt1302;
+2
View File
@@ -98,6 +98,7 @@ public class SeqFrame {
int baseCount = header.get1U();
int lastBase = -1;
int length = 0;
for (int base = 0; base < baseCount; base++) {
int flags = tran1.get1U();
@@ -106,6 +107,7 @@ public class SeqFrame {
}
if (skeleton.baseTypes[base] != SeqSkeleton.OP_BASE) {
// Look for any skipped ORIGIN bases and insert them into this frame.
for (int cur = base - 1; cur > lastBase; cur--) {
if (skeleton.baseTypes[cur] == SeqSkeleton.OP_BASE) {
bases[length] = cur;
+44 -40
View File
@@ -1,50 +1,54 @@
/**
* A {@link SeqSkeleton} describes the usage and relationship between groups.
* A {@link SeqSkeleton} describes the usage and relationship between groups of vertices.
*
* @see Model#applySequenceFrame(int)
* @see Model#applySequenceFrames(int, int, int[])
*/
public class SeqSkeleton {
/**
* A base can be thought of as the origin of a bone. This operator comes first before any other operations occur.
*/
public static final int OP_BASE = 0;
public static final int OP_TRANSLATE = 1;
public static final int OP_BASE = 0;
public static final int OP_TRANSLATE = 1;
public static final int OP_ROTATE = 2;
public static final int OP_SCALE = 3;
public static final int OP_ALPHA = 5;
/**
* A base type determines the operation performed on the labels belonging to it.
*
* @see #OP_BASE
* @see #OP_TRANSLATE
* @see #OP_ROTATE
* @see #OP_SCALE
* @see #OP_ALPHA
*/
public final int[] baseTypes;
/**
* The labels belonging to the base.
*/
public final int[][] baseLabels;
public static final int OP_ROTATE = 2;
public static final int OP_SCALE = 3;
public static final int OP_ALPHA = 5;
/**
* A base type determines the operation performed on the labels belonging to it.
*
* @see #OP_BASE
* @see #OP_TRANSLATE
* @see #OP_ROTATE
* @see #OP_SCALE
* @see #OP_ALPHA
*/
public final int[] baseTypes;
/**
* The labels belonging to the base.
* @see Model#createLabelReferences()
*/
public final int[][] baseLabels;
/**
* Constructs a new {@link SeqSkeleton} read from the provided input.
*
* @param in the input
*/
public SeqSkeleton(Buffer in) {
final int length = in.get1U();
baseTypes = new int[length];
baseLabels = new int[length][];
for (int group = 0; group < length; group++) {
baseTypes[group] = in.get1U();
}
for (int group = 0; group < length; group++) {
int count = in.get1U();
baseLabels[group] = new int[count];
for (int child = 0; child < count; child++) {
baseLabels[group][child] = in.get1U();
}
}
}
/**
* Constructs a new {@link SeqSkeleton} read from the provided input.
*
* @param in the input
*/
public SeqSkeleton(Buffer in) {
final int length = in.get1U();
baseTypes = new int[length];
baseLabels = new int[length][];
for (int group = 0; group < length; group++) {
baseTypes[group] = in.get1U();
}
for (int group = 0; group < length; group++) {
int count = in.get1U();
baseLabels[group] = new int[count];
for (int child = 0; child < count; child++) {
baseLabels[group][child] = in.get1U();
}
}
}
}
+6 -6
View File
@@ -31,9 +31,9 @@ public class SeqType {
public int speed = -1;
public int[] anIntArray357;
public boolean aBoolean358 = false;
public int anInt359 = 5;
public int anInt360 = -1;
public int anInt361 = -1;
public int priority = 5;
public int rightHandOverride = -1;
public int leftHandOverride = -1;
public int anInt362 = 99;
public int anInt363 = -1;
public int anInt364 = -1;
@@ -88,11 +88,11 @@ public class SeqType {
} else if (op == 4) {
aBoolean358 = true;
} else if (op == 5) {
anInt359 = buffer.get1U();
priority = buffer.get1U();
} else if (op == 6) {
anInt360 = buffer.get2U();
rightHandOverride = buffer.get2U();
} else if (op == 7) {
anInt361 = buffer.get2U();
leftHandOverride = buffer.get2U();
} else if (op == 8) {
anInt362 = buffer.get1U();
} else if (op == 9) {
+53 -46
View File
@@ -4,67 +4,74 @@
public class SpotAnimEntity extends Entity {
public final int anInt1560;
public final int anInt1561;
public final int anInt1562;
public final int anInt1563;
public final int anInt1564;
public final SpotAnimType aType_1568;
public boolean aBoolean1567 = false;
public int anInt1569;
public int anInt1570;
public final int plane;
public final int x;
public final int z;
public final int y;
public final int startCycle;
public final SpotAnimType type;
public boolean seqComplete = false;
public int seqFrame;
public int seqCycle;
public SpotAnimEntity(int i, int j, int l, int i1, int j1, int k1, int l1) {
aType_1568 = SpotAnimType.instances[i1];
anInt1560 = i;
anInt1561 = l1;
anInt1562 = k1;
anInt1563 = j1;
anInt1564 = j + l;
public SpotAnimEntity(int plane, int cycle, int delay, int id, int y, int z, int x) {
type = SpotAnimType.instances[id];
this.plane = plane;
this.x = x;
this.z = z;
this.y = y;
startCycle = cycle + delay;
}
@Override
public Model getModel() {
Model model = aType_1568.method266();
if (model == null) {
Model base = type.getModel();
if (base == null) {
return null;
}
int j = aType_1568.seq.primaryFrames[anInt1569];
Model model_1 = new Model(true, SeqFrame.isNull(j), false, model);
if (!aBoolean1567) {
model_1.createLabelReferences();
model_1.applySequenceFrame(j);
model_1.labelFaces = null;
model_1.labelVertices = null;
int frame = type.seq.primaryFrames[seqFrame];
Model model = new Model(true, SeqFrame.isNull(frame), false, base);
if (!seqComplete) {
model.createLabelReferences();
model.applySequenceFrame(frame);
model.labelFaces = null;
model.labelVertices = null;
}
if ((aType_1568.anInt410 != 128) || (aType_1568.anInt411 != 128)) {
model_1.scale(aType_1568.anInt410, aType_1568.anInt410, aType_1568.anInt411);
if ((type.scaleXY != 128) || (type.scaleZ != 128)) {
model.scale(type.scaleXY, type.scaleXY, type.scaleZ);
}
if (aType_1568.anInt412 != 0) {
if (aType_1568.anInt412 == 90) {
model_1.rotateY90();
if (type.rotation != 0) {
if (type.rotation == 90) {
model.rotateY90();
}
if (aType_1568.anInt412 == 180) {
model_1.rotateY90();
model_1.rotateY90();
if (type.rotation == 180) {
model.rotateY90();
model.rotateY90();
}
if (aType_1568.anInt412 == 270) {
model_1.rotateY90();
model_1.rotateY90();
model_1.rotateY90();
if (type.rotation == 270) {
model.rotateY90();
model.rotateY90();
model.rotateY90();
}
}
model_1.calculateNormals(64 + aType_1568.anInt413, 850 + aType_1568.anInt414, -30, -50, -30, true);
return model_1;
model.calculateNormals(64 + type.lightAmbient, 850 + type.lightAttenuation, -30, -50, -30, true);
return model;
}
public void method454(int i) {
for (anInt1570 += i; anInt1570 > aType_1568.seq.getFrameDelay(anInt1569); ) {
anInt1570 -= aType_1568.seq.getFrameDelay(anInt1569) + 1;
anInt1569++;
if ((anInt1569 >= aType_1568.seq.frameCount) && ((anInt1569 < 0) || (anInt1569 >= aType_1568.seq.frameCount))) {
anInt1569 = 0;
aBoolean1567 = true;
public void update(int delta) {
for (seqCycle += delta; seqCycle > type.seq.getFrameDelay(seqFrame); ) {
seqCycle -= type.seq.getFrameDelay(seqFrame) + 1;
seqFrame++;
if (seqFrame >= type.seq.frameCount) {
seqFrame = 0;
seqComplete = true;
}
}
}
+29 -22
View File
@@ -15,80 +15,87 @@ public class SpotAnimType {
public static void unpack(FileArchive archive) throws IOException {
Buffer buffer = new Buffer(archive.read("spotanim.dat"));
count = buffer.get2U();
if (instances == null) {
instances = new SpotAnimType[count];
}
for (int i = 0; i < count; i++) {
if (instances[i] == null) {
instances[i] = new SpotAnimType();
}
instances[i].index = i;
instances[i].method265(buffer);
instances[i].read(buffer);
}
}
public final int[] anIntArray408 = new int[6];
public final int[] anIntArray409 = new int[6];
public final int[] colorSrc = new int[6];
public final int[] colorDst = new int[6];
public int index;
public int anInt405;
public int modelId;
public int seqId = -1;
public SeqType seq;
public int anInt410 = 128;
public int anInt411 = 128;
public int anInt412;
public int anInt413;
public int anInt414;
public int scaleXY = 128;
public int scaleZ = 128;
public int rotation;
public int lightAmbient;
public int lightAttenuation;
public SpotAnimType() {
}
public void method265(Buffer buffer) {
public void read(Buffer buffer) {
do {
int i = buffer.get1U();
if (i == 0) {
return;
}
if (i == 1) {
anInt405 = buffer.get2U();
modelId = buffer.get2U();
} else if (i == 2) {
seqId = buffer.get2U();
if (SeqType.instances != null) {
seq = SeqType.instances[seqId];
}
} else if (i == 4) {
anInt410 = buffer.get2U();
scaleXY = buffer.get2U();
} else if (i == 5) {
anInt411 = buffer.get2U();
scaleZ = buffer.get2U();
} else if (i == 6) {
anInt412 = buffer.get2U();
rotation = buffer.get2U();
} else if (i == 7) {
anInt413 = buffer.get1U();
lightAmbient = buffer.get1U();
} else if (i == 8) {
anInt414 = buffer.get1U();
lightAttenuation = buffer.get1U();
} else if ((i >= 40) && (i < 50)) {
anIntArray408[i - 40] = buffer.get2U();
colorSrc[i - 40] = buffer.get2U();
} else if ((i >= 50) && (i < 60)) {
anIntArray409[i - 50] = buffer.get2U();
colorDst[i - 50] = buffer.get2U();
} else {
System.out.println("Error unrecognised spotanim config code: " + i);
}
} while (true);
}
public Model method266() {
public Model getModel() {
Model model = modelCache.get(index);
if (model != null) {
return model;
}
model = Model.tryGet(anInt405);
model = Model.tryGet(modelId);
if (model == null) {
return null;
}
for (int i = 0; i < 6; i++) {
if (anIntArray408[0] != 0) {
model.recolor(anIntArray408[i], anIntArray409[i]);
if (colorSrc[0] != 0) {
model.recolor(colorSrc[i], colorDst[i]);
}
}
modelCache.put(index, model);
return model;
}