Occluder Debug
Incoming Packet Constants
This commit is contained in:
1 parent
e0019f7672
commit
e5072ee11a
18 files changed
+12533
-12092
No files matched your search
@@ -108,7 +108,7 @@ public class ChatCompression {
|
||||
}
|
||||
}
|
||||
|
||||
public static String method527(String string) {
|
||||
public static String format(String string) {
|
||||
buf.position = 0;
|
||||
pack(string, buf);
|
||||
int length = buf.position;
|
||||
|
||||
@@ -314,7 +314,7 @@ public class Component {
|
||||
public int[] scriptOperand;
|
||||
public int[][] scripts;
|
||||
public int scrollableHeight;
|
||||
public int scrollY;
|
||||
public int scrollPosition;
|
||||
public int seqCycle;
|
||||
public int seqFrame;
|
||||
public int seqID;
|
||||
|
||||
@@ -55,6 +55,47 @@ public class Draw2D {
|
||||
Arrays.fill(pixels, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bresenham's line algorithm.
|
||||
* @param x1 the first x coordinate.
|
||||
* @param y1 the first y coordinate.
|
||||
* @param x2 the second x coordinate.
|
||||
* @param y2 the second y coordinate.
|
||||
* @param rgb the color.
|
||||
*/
|
||||
public static void drawLine(int x1, int y1, int x2, int y2, int rgb) {
|
||||
int dx = Math.abs(x2 - x1);
|
||||
int dy = Math.abs(y2 - y1);
|
||||
|
||||
int sx = (x1 < x2) ? 1 : -1;
|
||||
int sy = (y1 < y2) ? 1 : -1;
|
||||
|
||||
int err = dx - dy;
|
||||
|
||||
while (true) {
|
||||
if (x1 >= left && x1 < right && y1 >= top && y1 < bottom) {
|
||||
pixels[x1 + (y1 * width)] = rgb;
|
||||
}
|
||||
|
||||
if (x1 == x2 && y1 == y2) {
|
||||
break;
|
||||
}
|
||||
|
||||
int e2 = 2 * err;
|
||||
|
||||
if (e2 > -dy) {
|
||||
err = err - dy;
|
||||
x1 = x1 + sx;
|
||||
}
|
||||
|
||||
if (e2 < dx) {
|
||||
err = err + dx;
|
||||
y1 = y1 + sy;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void fillRect(int x, int y, int width, int height, int rgb, int alpha) {
|
||||
if (x < left) {
|
||||
width -= left - x;
|
||||
|
||||
+32
-36
@@ -1313,56 +1313,52 @@ public class Draw3D {
|
||||
/**
|
||||
* Long story short, this defines a plane in view space and traverses it to determine uv values. It's an impl of
|
||||
* this algorithm: <a href="https://www.gamers.org/dEngine/rsc/pcgpe-1.0/texture.txt">texture.txt</a>
|
||||
* @param yA
|
||||
* @param yB
|
||||
* @param yC
|
||||
* @param xA
|
||||
* @param xB
|
||||
* @param xC
|
||||
* @param shadeA
|
||||
* @param shadeB
|
||||
* @param shadeC
|
||||
* @param txA
|
||||
* @param txB
|
||||
* @param txC
|
||||
* @param tyA
|
||||
* @param tyB
|
||||
* @param tyC
|
||||
* @param tzA
|
||||
* @param tzB
|
||||
* @param tzC
|
||||
* @param texture
|
||||
*
|
||||
*/
|
||||
public static void fillTexturedTriangle(int yA, int yB, int yC, int xA, int xB, int xC, int shadeA, int shadeB, int shadeC, int txA, int txB, int txC, int tyA, int tyB, int tyC, int tzA, int tzB, int tzC, int texture) {
|
||||
int[] texels = getTexels(texture);
|
||||
opaque = !textureTranslucent[texture];
|
||||
|
||||
txB = txA - txB;
|
||||
tyB = tyA - tyB;
|
||||
tzB = tzA - tzB;
|
||||
int originX = txA;
|
||||
int originY = tyA;
|
||||
int originZ = tzA;
|
||||
|
||||
txC -= txA;
|
||||
tyC -= tyA;
|
||||
tzC -= tzA;
|
||||
int verticalX = originX - txB;
|
||||
int verticalY = originY - tyB;
|
||||
int verticalZ = originZ - tzB;
|
||||
|
||||
int horizontalX = txC - originX;
|
||||
int horizontalY = tyC - originY;
|
||||
int horizontalZ = tzC - originZ;
|
||||
|
||||
// ! It's important to know the document referenced above assumes the following coordinate system:
|
||||
// +X = Right
|
||||
// +Y = Forward
|
||||
// +Z = Up
|
||||
|
||||
// RS2 coordinate system is as follows:
|
||||
// +X = Right
|
||||
// +Y = Down
|
||||
// +Z = Forward
|
||||
|
||||
// Which means we must swap Y and Z for our code to coincide.
|
||||
|
||||
// The reason I called horizontals 'stride' and vertical 'step' is because the drawTexturedScanline is unrolled
|
||||
// and does 8 pixels per 'stride' as an optimization. If you were to roll the loops in drawTexturedScanline then
|
||||
// you can name these StepHorizontal and change the bitshift to << 5 just like its vertical sibling.
|
||||
// you can name these StepHorizontal and change the bitshift to << 5 like its vertical sibling.
|
||||
|
||||
// (a << 3) is the same as (a * 8)
|
||||
|
||||
int u = ((txC * tyA) - (tyC * txA)) << 14;
|
||||
int uStrideHorizontal = ((tyC * tzA) - (tzC * tyA)) << 8;
|
||||
int uStepVertical = ((tzC * txA) - (txC * tzA)) << 5;
|
||||
int u = ((horizontalX * originY) - (horizontalY * originX)) << 14;
|
||||
int uStrideHorizontal = ((horizontalY * originZ) - (horizontalZ * originY)) << 8;
|
||||
int uStepVertical = ((horizontalZ * originX) - (horizontalX * originZ)) << 5;
|
||||
|
||||
int v = ((txB * tyA) - (tyB * txA)) << 14;
|
||||
int vStrideHorizontal = ((tyB * tzA) - (tzB * tyA)) << 8;
|
||||
int vStepVertical = ((tzB * txA) - (txB * tzA)) << 5;
|
||||
int v = ((verticalX * originY) - (verticalY * originX)) << 14;
|
||||
int vStrideHorizontal = ((verticalY * originZ) - (verticalZ * originY)) << 8;
|
||||
int vStepVertical = ((verticalZ * originX) - (verticalX * originZ)) << 5;
|
||||
|
||||
int w = ((tyB * txC) - (txB * tyC)) << 14;
|
||||
int wStrideHorizontal = ((tzB * tyC) - (tyB * tzC)) << 8;
|
||||
int wStepVertical = ((txB * tzC) - (tzB * txC)) << 5;
|
||||
int w = ((verticalY * horizontalX) - (verticalX * horizontalY)) << 14;
|
||||
int wStrideHorizontal = ((verticalZ * horizontalY) - (verticalY * horizontalZ)) << 8;
|
||||
int wStepVertical = ((verticalX * horizontalZ) - (verticalZ * horizontalX)) << 5;
|
||||
|
||||
int xStepAB = 0;
|
||||
int xStepBC = 0;
|
||||
|
||||
+12084
-11788
File diff suppressed because it is too large.
Load diff
@@ -27,14 +27,14 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
public int mouseButton;
|
||||
public int mouseX;
|
||||
public int mouseY;
|
||||
public int lastMousePressButton;
|
||||
public int lastMousePressX;
|
||||
public int lastMousePressY;
|
||||
public long lastMousePressTime;
|
||||
public int mousePressButton;
|
||||
public int mousePressX;
|
||||
public int mousePressY;
|
||||
public long mousePressTime;
|
||||
public int lastMouseClickButton;
|
||||
public int lastMouseClickX;
|
||||
public int lastMouseClickY;
|
||||
public long lastMouseClickTime;
|
||||
public int mouseClickButton;
|
||||
public int mouseClickX;
|
||||
public int mouseClickY;
|
||||
public long mouseClickTime;
|
||||
public int keyQueueReadPos;
|
||||
public int keyQueueWritePos;
|
||||
|
||||
@@ -140,11 +140,11 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
}
|
||||
|
||||
for (; count < 256; count += ratio) {
|
||||
mousePressButton = lastMousePressButton;
|
||||
mousePressX = lastMousePressX;
|
||||
mousePressY = lastMousePressY;
|
||||
mousePressTime = lastMousePressTime;
|
||||
lastMousePressButton = 0;
|
||||
mouseClickButton = lastMouseClickButton;
|
||||
mouseClickX = lastMouseClickX;
|
||||
mouseClickY = lastMouseClickY;
|
||||
mouseClickTime = lastMouseClickTime;
|
||||
lastMouseClickButton = 0;
|
||||
update();
|
||||
keyQueueReadPos = keyQueueWritePos;
|
||||
}
|
||||
@@ -237,15 +237,15 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
int y = e.getY();
|
||||
|
||||
idleCycles = 0;
|
||||
lastMousePressX = x;
|
||||
lastMousePressY = y;
|
||||
lastMousePressTime = System.currentTimeMillis();
|
||||
lastMouseClickX = x;
|
||||
lastMouseClickY = y;
|
||||
lastMouseClickTime = System.currentTimeMillis();
|
||||
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
lastMousePressButton = 2;
|
||||
lastMouseClickButton = 2;
|
||||
mouseButton = 2;
|
||||
} else {
|
||||
lastMousePressButton = 1;
|
||||
lastMouseClickButton = 1;
|
||||
mouseButton = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class LocEntity extends Entity {
|
||||
seqCycle = Game.loopCycle - delta;
|
||||
|
||||
if (seq != null) {
|
||||
transformID = seq.transformIndices[seqFrame];
|
||||
transformID = seq.transformIDs[seqFrame];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -18,12 +18,12 @@ public class LocType {
|
||||
/**
|
||||
* This is where dynamically generated models go.
|
||||
*/
|
||||
public static LRUMap<Long, Model> dynamicCache = new LRUMap(30);
|
||||
public static LRUMap<Long, Model> modelCacheDynamic = new LRUMap(30);
|
||||
public static LocType[] cache;
|
||||
/**
|
||||
* This is where basic models go.
|
||||
*/
|
||||
public static LRUMap<Long, Model> staticCache = new LRUMap(500);
|
||||
public static LRUMap<Long, Model> modelCacheStatic = new LRUMap(500);
|
||||
|
||||
public static LocType get(int i) {
|
||||
if (i >= count) {
|
||||
@@ -44,8 +44,8 @@ public class LocType {
|
||||
}
|
||||
|
||||
public static void unload() {
|
||||
staticCache = null;
|
||||
dynamicCache = null;
|
||||
modelCacheStatic = null;
|
||||
modelCacheDynamic = null;
|
||||
offsets = null;
|
||||
cache = null;
|
||||
dat = null;
|
||||
@@ -210,15 +210,15 @@ public class LocType {
|
||||
return model;
|
||||
}
|
||||
|
||||
public boolean method579() {
|
||||
public boolean validate() {
|
||||
if (modelIDs == null) {
|
||||
return true;
|
||||
}
|
||||
boolean flag1 = true;
|
||||
for (int j : modelIDs) {
|
||||
flag1 &= Model.validate(j & 0xffff);
|
||||
boolean ok = true;
|
||||
for (int modelID : modelIDs) {
|
||||
ok &= Model.validate(modelID & 0xffff);
|
||||
}
|
||||
return flag1;
|
||||
return ok;
|
||||
}
|
||||
|
||||
public LocType getOverrideType() {
|
||||
@@ -252,7 +252,7 @@ public class LocType {
|
||||
}
|
||||
|
||||
bitset = ((long) index << 6) + rotation + ((long) (transformID + 1) << 32);
|
||||
Model cached = dynamicCache.get(bitset);
|
||||
Model cached = modelCacheDynamic.get(bitset);
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -272,7 +272,7 @@ public class LocType {
|
||||
modelID += 0x10000;
|
||||
}
|
||||
|
||||
model = staticCache.get(modelID);
|
||||
model = modelCacheStatic.get(modelID);
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelID & 0xffff);
|
||||
if (model == null) {
|
||||
@@ -281,7 +281,7 @@ public class LocType {
|
||||
if (flip) {
|
||||
model.rotateY180();
|
||||
}
|
||||
staticCache.put((long) modelID, model);
|
||||
modelCacheStatic.put((long) modelID, model);
|
||||
}
|
||||
|
||||
if (modelCount > 1) {
|
||||
@@ -309,7 +309,7 @@ public class LocType {
|
||||
|
||||
bitset = ((long) this.index << 6) + ((long) kindIndex << 3) + rotation + ((long) (transformID + 1) << 32);
|
||||
|
||||
Model cached = dynamicCache.get(bitset);
|
||||
Model cached = modelCacheDynamic.get(bitset);
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -322,7 +322,7 @@ public class LocType {
|
||||
modelID += 0x10000;
|
||||
}
|
||||
|
||||
model = staticCache.get(modelID);
|
||||
model = modelCacheStatic.get(modelID);
|
||||
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelID & 0xffff);
|
||||
@@ -335,7 +335,7 @@ public class LocType {
|
||||
model.rotateY180();
|
||||
}
|
||||
|
||||
staticCache.put((long) modelID, model);
|
||||
modelCacheStatic.put((long) modelID, model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ public class LocType {
|
||||
modified.objRaise = modified.minY;
|
||||
}
|
||||
|
||||
dynamicCache.put(bitset, modified);
|
||||
modelCacheDynamic.put(bitset, modified);
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ public class NPCEntity extends PathingEntity {
|
||||
|
||||
public Model getSequencedModel() {
|
||||
if ((super.primarySeqID >= 0) && (super.primarySeqDelay == 0)) {
|
||||
int primaryTransformID = SeqType.instances[super.primarySeqID].transformIndices[super.primarySeqFrame];
|
||||
int primaryTransformID = SeqType.instances[super.primarySeqID].transformIDs[super.primarySeqFrame];
|
||||
int secondaryTransformID = -1;
|
||||
if ((super.secondarySeqID >= 0) && (super.secondarySeqID != super.seqStandID)) {
|
||||
secondaryTransformID = SeqType.instances[super.secondarySeqID].transformIndices[super.secondarySeqFrame];
|
||||
secondaryTransformID = SeqType.instances[super.secondarySeqID].transformIDs[super.secondarySeqFrame];
|
||||
}
|
||||
return type.getSequencedModel(secondaryTransformID, primaryTransformID, SeqType.instances[super.primarySeqID].mask);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class NPCEntity extends PathingEntity {
|
||||
int transformID = -1;
|
||||
|
||||
if (super.secondarySeqID >= 0) {
|
||||
transformID = SeqType.instances[super.secondarySeqID].transformIndices[super.secondarySeqFrame];
|
||||
transformID = SeqType.instances[super.secondarySeqID].transformIDs[super.secondarySeqFrame];
|
||||
}
|
||||
|
||||
return type.getSequencedModel(-1, transformID, null);
|
||||
@@ -47,7 +47,7 @@ public class NPCEntity extends PathingEntity {
|
||||
Model model0 = spotanim.getModel();
|
||||
|
||||
if (model0 != null) {
|
||||
int transformID = spotanim.seq.transformIndices[super.spotanimFrame];
|
||||
int transformID = spotanim.seq.transformIDs[super.spotanimFrame];
|
||||
|
||||
// create a copy of the model
|
||||
Model model1 = new Model(true, SeqTransform.isNull(transformID), false, model0);
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
public class PacketConstants {
|
||||
|
||||
public static final int[] SIZE = new int[256];
|
||||
|
||||
static {
|
||||
SIZE[4] = 6;
|
||||
SIZE[8] = 4;
|
||||
SIZE[24] = 1;
|
||||
SIZE[34] = -2;
|
||||
SIZE[35] = 4;
|
||||
SIZE[36] = 3;
|
||||
SIZE[44] = 5;
|
||||
SIZE[47] = 6;
|
||||
SIZE[50] = 9;
|
||||
SIZE[53] = -2;
|
||||
SIZE[60] = -2;
|
||||
SIZE[61] = 1;
|
||||
SIZE[64] = 2;
|
||||
SIZE[65] = -2;
|
||||
SIZE[70] = 6;
|
||||
SIZE[71] = 3;
|
||||
SIZE[72] = 2;
|
||||
SIZE[73] = 4;
|
||||
SIZE[74] = 2;
|
||||
SIZE[75] = 4;
|
||||
SIZE[79] = 4;
|
||||
SIZE[81] = -2;
|
||||
SIZE[84] = 7;
|
||||
SIZE[85] = 2;
|
||||
SIZE[87] = 6;
|
||||
SIZE[97] = 2;
|
||||
SIZE[99] = 1;
|
||||
SIZE[101] = 2;
|
||||
SIZE[104] = -1;
|
||||
SIZE[105] = 4;
|
||||
SIZE[106] = 1;
|
||||
SIZE[110] = 1;
|
||||
SIZE[114] = 2;
|
||||
SIZE[117] = 15;
|
||||
SIZE[121] = 4;
|
||||
SIZE[122] = 4;
|
||||
SIZE[126] = -2;
|
||||
SIZE[134] = 6;
|
||||
SIZE[142] = 2;
|
||||
SIZE[147] = 14;
|
||||
SIZE[151] = 4;
|
||||
SIZE[156] = 3;
|
||||
SIZE[160] = 4;
|
||||
SIZE[164] = 2;
|
||||
SIZE[166] = 6;
|
||||
SIZE[171] = 3;
|
||||
SIZE[174] = 5;
|
||||
SIZE[176] = 10;
|
||||
SIZE[177] = 6;
|
||||
SIZE[185] = 2;
|
||||
SIZE[196] = -1;
|
||||
SIZE[200] = 4;
|
||||
SIZE[206] = 3;
|
||||
SIZE[208] = 2;
|
||||
SIZE[214] = -2;
|
||||
SIZE[215] = 7;
|
||||
SIZE[218] = 2;
|
||||
SIZE[221] = 1;
|
||||
SIZE[230] = 8;
|
||||
SIZE[240] = 2;
|
||||
SIZE[241] = -2;
|
||||
SIZE[246] = 6;
|
||||
SIZE[248] = 4;
|
||||
SIZE[249] = 3;
|
||||
SIZE[253] = -1;
|
||||
SIZE[254] = 6;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
public final class PacketIn {
|
||||
|
||||
public static final int[] SIZE = new int[256];
|
||||
|
||||
public static final int CAMERA_DISABLE_CINEMATIC = 107;
|
||||
public static final int CAMERA_EFFECT = 35;
|
||||
public static final int CAMERA_LOOK_AT = 177;
|
||||
public static final int CAMERA_SET_POSITION = 166;
|
||||
public static final int CHAT_COMPONENT = 164;
|
||||
public static final int CHAT_COMPONENT_STICKY = 218;
|
||||
public static final int CHAT_MESSAGE = 196;
|
||||
public static final int CLEAR_COMPONENTS = 219;
|
||||
public static final int CLEAR_MINIMAP_FLAG = 78;
|
||||
public static final int COMPONENT_COLOR = 122;
|
||||
public static final int COMPONENT_HIDDEN = 171;
|
||||
public static final int COMPONENT_MODEL = 8;
|
||||
public static final int COMPONENT_MODEL_NPC = 75;
|
||||
public static final int COMPONENT_MODEL_OBJ = 246;
|
||||
public static final int COMPONENT_MODEL_PLAYER = 185;
|
||||
public static final int COMPONENT_MODEL_ROTATION = 230;
|
||||
public static final int COMPONENT_POSITION = 70;
|
||||
public static final int COMPONENT_RESET_SEQ = 142;
|
||||
public static final int COMPONENT_SCROLL_Y = 79;
|
||||
public static final int COMPONENT_SEQ = 200;
|
||||
public static final int COMPONENT_TEXT = 126;
|
||||
public static final int DISCONNECT = 109;
|
||||
public static final int ENERGY = 110;
|
||||
public static final int FRIENDSERVER_STATUS = 221;
|
||||
public static final int FRIEND_STATUS = 50;
|
||||
public static final int HINT = 254;
|
||||
public static final int IGNORE_LIST = 214;
|
||||
public static final int INPUT_AMOUNT = 27;
|
||||
public static final int INPUT_NAME = 187;
|
||||
public static final int INVENTORY = 53;
|
||||
public static final int INVENTORY_CLEAR = 72;
|
||||
public static final int INVENTORY_UPDATE = 34;
|
||||
public static final int JINGLE = 121;
|
||||
public static final int LOCAL_PLAYER = 249;
|
||||
public static final int LOGIN_INFO = 176;
|
||||
public static final int MESSAGE = 253;
|
||||
public static final int MINIMAP_STATE = 99;
|
||||
public static final int MULTIZONE = 61;
|
||||
public static final int PLAYER_OPTION = 104;
|
||||
public static final int PRIVACY_SETTINGS = 206;
|
||||
public static final int RESTORE_VARS = 68;
|
||||
public static final int SCENE_LOAD = 73;
|
||||
public static final int SCENE_LOAD_INSTANCED = 241;
|
||||
public static final int SCENE_RESET_SEQ = 1;
|
||||
public static final int SKILL = 134;
|
||||
public static final int SONG = 74;
|
||||
public static final int SOUND = 174;
|
||||
public static final int SYNC_NPCS = 65;
|
||||
public static final int SYNC_PLAYERS = 81;
|
||||
public static final int SYSTEM_UPDATE = 114;
|
||||
public static final int TAB_COMPONENT = 71;
|
||||
public static final int TAB_HINT = 24;
|
||||
public static final int TAB_SELECTED = 106;
|
||||
public static final int VARP_BYTE = 36;
|
||||
public static final int VARP_INT = 87;
|
||||
public static final int VIEWPORT_AND_SIDEBAR_COMPONENTS = 248;
|
||||
public static final int VIEWPORT_COMPONENT = 97;
|
||||
public static final int VIEWPORT_OVERLAY_COMPONENT = 208;
|
||||
public static final int WEIGHT = 240;
|
||||
public static final int ZONE_BASE = 85;
|
||||
public static final int ZONE_CLEAR = 64;
|
||||
public static final int ZONE_UPDATE = 60;
|
||||
|
||||
static {
|
||||
SIZE[4] = 6;
|
||||
SIZE[8] = 4;
|
||||
SIZE[24] = 1;
|
||||
SIZE[34] = -2;
|
||||
SIZE[35] = 4;
|
||||
SIZE[36] = 3;
|
||||
SIZE[44] = 5;
|
||||
SIZE[47] = 6;
|
||||
SIZE[50] = 9;
|
||||
SIZE[53] = -2;
|
||||
SIZE[60] = -2;
|
||||
SIZE[61] = 1;
|
||||
SIZE[64] = 2;
|
||||
SIZE[65] = -2;
|
||||
SIZE[70] = 6;
|
||||
SIZE[71] = 3;
|
||||
SIZE[72] = 2;
|
||||
SIZE[73] = 4;
|
||||
SIZE[74] = 2;
|
||||
SIZE[75] = 4;
|
||||
SIZE[79] = 4;
|
||||
SIZE[81] = -2;
|
||||
SIZE[84] = 7;
|
||||
SIZE[85] = 2;
|
||||
SIZE[87] = 6;
|
||||
SIZE[97] = 2;
|
||||
SIZE[99] = 1;
|
||||
SIZE[101] = 2;
|
||||
SIZE[104] = -1;
|
||||
SIZE[105] = 4;
|
||||
SIZE[106] = 1;
|
||||
SIZE[110] = 1;
|
||||
SIZE[114] = 2;
|
||||
SIZE[117] = 15;
|
||||
SIZE[121] = 4;
|
||||
SIZE[122] = 4;
|
||||
SIZE[126] = -2;
|
||||
SIZE[134] = 6;
|
||||
SIZE[142] = 2;
|
||||
SIZE[147] = 14;
|
||||
SIZE[151] = 4;
|
||||
SIZE[156] = 3;
|
||||
SIZE[160] = 4;
|
||||
SIZE[164] = 2;
|
||||
SIZE[166] = 6;
|
||||
SIZE[171] = 3;
|
||||
SIZE[174] = 5;
|
||||
SIZE[176] = 10;
|
||||
SIZE[177] = 6;
|
||||
SIZE[185] = 2;
|
||||
SIZE[196] = -1;
|
||||
SIZE[200] = 4;
|
||||
SIZE[206] = 3;
|
||||
SIZE[208] = 2;
|
||||
SIZE[214] = -2;
|
||||
SIZE[215] = 7;
|
||||
SIZE[218] = 2;
|
||||
SIZE[221] = 1;
|
||||
SIZE[230] = 8;
|
||||
SIZE[240] = 2;
|
||||
SIZE[241] = -2;
|
||||
SIZE[246] = 6;
|
||||
SIZE[248] = 4;
|
||||
SIZE[249] = 3;
|
||||
SIZE[253] = -1;
|
||||
SIZE[254] = 6;
|
||||
}
|
||||
|
||||
private PacketIn() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public final class PacketOut {
|
||||
private PacketOut() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
Model spotModel2 = new Model(true, SeqTransform.isNull(super.spotanimFrame), false, spotModel1);
|
||||
spotModel2.translate(0, -super.spotanimY, 0);
|
||||
spotModel2.createLabelReferences();
|
||||
spotModel2.applyTransform(spot.seq.transformIndices[super.spotanimFrame]);
|
||||
spotModel2.applyTransform(spot.seq.transformIDs[super.spotanimFrame]);
|
||||
spotModel2.labelFaces = null;
|
||||
spotModel2.labelVertices = null;
|
||||
if ((spot.scaleXY != 128) || (spot.scaleZ != 128)) {
|
||||
@@ -219,9 +219,9 @@ public class PlayerEntity extends PathingEntity {
|
||||
if (npcType != null) {
|
||||
int transformID = -1;
|
||||
if ((super.primarySeqID >= 0) && (super.primarySeqDelay == 0)) {
|
||||
transformID = SeqType.instances[super.primarySeqID].transformIndices[super.primarySeqFrame];
|
||||
transformID = SeqType.instances[super.primarySeqID].transformIDs[super.primarySeqFrame];
|
||||
} else if (super.secondarySeqID >= 0) {
|
||||
transformID = SeqType.instances[super.secondarySeqID].transformIndices[super.secondarySeqFrame];
|
||||
transformID = SeqType.instances[super.secondarySeqID].transformIDs[super.secondarySeqFrame];
|
||||
}
|
||||
return npcType.getSequencedModel(-1, transformID, null);
|
||||
}
|
||||
@@ -234,10 +234,10 @@ public class PlayerEntity extends PathingEntity {
|
||||
|
||||
if ((super.primarySeqID >= 0) && (super.primarySeqDelay == 0)) {
|
||||
SeqType type = SeqType.instances[super.primarySeqID];
|
||||
primaryTransformID = type.transformIndices[super.primarySeqFrame];
|
||||
primaryTransformID = type.transformIDs[super.primarySeqFrame];
|
||||
|
||||
if ((super.secondarySeqID >= 0) && (super.secondarySeqID != super.seqStandID)) {
|
||||
secondaryTransformID = SeqType.instances[super.secondarySeqID].transformIndices[super.secondarySeqFrame];
|
||||
secondaryTransformID = SeqType.instances[super.secondarySeqID].transformIDs[super.secondarySeqFrame];
|
||||
}
|
||||
|
||||
if (type.rightHandOverride >= 0) {
|
||||
@@ -250,7 +250,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
hashCode += ((long) leftHandValue - appearances[3]) << 16;
|
||||
}
|
||||
} else if (super.secondarySeqID >= 0) {
|
||||
primaryTransformID = SeqType.instances[super.secondarySeqID].transformIndices[super.secondarySeqFrame];
|
||||
primaryTransformID = SeqType.instances[super.secondarySeqID].transformIDs[super.secondarySeqFrame];
|
||||
}
|
||||
|
||||
Model model = modelCache.get(hashCode);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ProjectileEntity extends Entity {
|
||||
int transformID = -1;
|
||||
|
||||
if (spotanim.seq != null) {
|
||||
transformID = spotanim.seq.transformIndices[seqFrame];
|
||||
transformID = spotanim.seq.transformIDs[seqFrame];
|
||||
}
|
||||
|
||||
Model model = new Model(true, SeqTransform.isNull(transformID), false, tmp);
|
||||
|
||||
@@ -104,6 +104,8 @@ public class Scene {
|
||||
public static int[] levelOccluderCount = new int[LEVEL_COUNT];
|
||||
public static SceneOccluder[][] levelOccluders = new SceneOccluder[LEVEL_COUNT][500];
|
||||
public static int activeOccluderCount;
|
||||
public static int activeWallOccluderCount;
|
||||
public static int activeGroundOccluderCount;
|
||||
public static DoublyLinkedList drawTileQueue = new DoublyLinkedList();
|
||||
public static boolean[][][][] visibilityMatrix = new boolean[8][32][51][51];
|
||||
public static boolean[][] visibilityMap;
|
||||
@@ -123,7 +125,7 @@ public class Scene {
|
||||
visibilityMap = null;
|
||||
}
|
||||
|
||||
public static void addOccluder(int level, int minX, int maxY, int maxX, int maxZ, int minY, int minZ, int type) {
|
||||
public static void addOccluder(int level, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int type) {
|
||||
SceneOccluder occluder = new SceneOccluder();
|
||||
occluder.minTileX = minX / 128;
|
||||
occluder.maxTileX = maxX / 128;
|
||||
@@ -161,7 +163,7 @@ public class Scene {
|
||||
pitchDistance[pitchLevel] = (distance * Draw3D.sin[angle]) >> 16;
|
||||
}
|
||||
|
||||
boolean[][][][] visibilityMap = new boolean[9][32][53][53];
|
||||
boolean[][][][] matrix = new boolean[9][32][53][53];
|
||||
|
||||
for (int pitch = 128; pitch <= 384; pitch += 32) {
|
||||
for (int yaw = 0; yaw < 2048; yaw += 64) {
|
||||
@@ -184,7 +186,7 @@ public class Scene {
|
||||
break;
|
||||
}
|
||||
}
|
||||
visibilityMap[pitchLevel][yawLevel][dx + 25 + 1][dz + 25 + 1] = visible;
|
||||
matrix[pitchLevel][yawLevel][dx + 25 + 1][dz + 25 + 1] = visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,14 +202,14 @@ public class Scene {
|
||||
check_area:
|
||||
for (int dx = -1; dx <= 1; dx++) {
|
||||
for (int dz = -1; dz <= 1; dz++) {
|
||||
if (visibilityMap[pitchLevel][yawLevel][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
if (matrix[pitchLevel][yawLevel][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
visible = true;
|
||||
} else if (visibilityMap[pitchLevel][(yawLevel + 1) % 31][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
} else if (matrix[pitchLevel][(yawLevel + 1) % 31][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
visible = true;
|
||||
} else if (visibilityMap[pitchLevel + 1][yawLevel][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
} else if (matrix[pitchLevel + 1][yawLevel][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
visible = true;
|
||||
} else {
|
||||
if (!visibilityMap[pitchLevel + 1][(yawLevel + 1) % 31][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
if (!matrix[pitchLevel + 1][(yawLevel + 1) % 31][x + dx + 25 + 1][z + dz + 25 + 1]) {
|
||||
continue;
|
||||
}
|
||||
visible = true;
|
||||
@@ -268,15 +270,18 @@ public class Scene {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < LEVEL_COUNT; l++) {
|
||||
for (int j1 = 0; j1 < levelOccluderCount[l]; j1++) {
|
||||
levelOccluders[l][j1] = null;
|
||||
}
|
||||
levelOccluderCount[l] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < temporaryLocCount; i++) {
|
||||
temporaryLocs[i] = null;
|
||||
}
|
||||
|
||||
temporaryLocCount = 0;
|
||||
Arrays.fill(locBuffer, null);
|
||||
}
|
||||
@@ -1994,6 +1999,9 @@ public class Scene {
|
||||
SceneOccluder[] occluders = levelOccluders[topLevel];
|
||||
|
||||
activeOccluderCount = 0;
|
||||
activeGroundOccluderCount = 0;
|
||||
activeWallOccluderCount = 0;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
SceneOccluder occluder = occluders[i];
|
||||
|
||||
@@ -2048,6 +2056,7 @@ public class Scene {
|
||||
occluder.minDeltaY = ((occluder.minY - eyeY) << 8) / deltaMinX;
|
||||
occluder.maxDeltaY = ((occluder.maxY - eyeY) << 8) / deltaMinX;
|
||||
activeOccluders[activeOccluderCount++] = occluder;
|
||||
activeWallOccluderCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2100,6 +2109,7 @@ public class Scene {
|
||||
occluder.minDeltaY = ((occluder.minY - eyeY) << 8) / deltaMinZ;
|
||||
occluder.maxDeltaY = ((occluder.maxY - eyeY) << 8) / deltaMinZ;
|
||||
activeOccluders[activeOccluderCount++] = occluder;
|
||||
activeWallOccluderCount++;
|
||||
} else if (occluder.type == 4) {
|
||||
int deltaMaxY = occluder.minY - eyeY;
|
||||
|
||||
@@ -2151,6 +2161,7 @@ public class Scene {
|
||||
occluder.minDeltaZ = ((occluder.minZ - eyeZ) << 8) / deltaMaxY;
|
||||
occluder.maxDeltaZ = ((occluder.maxZ - eyeZ) << 8) / deltaMaxY;
|
||||
activeOccluders[activeOccluderCount++] = occluder;
|
||||
activeGroundOccluderCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+151
-126
@@ -7,7 +7,7 @@ public class SceneBuilder {
|
||||
public static final int[] anIntArray137 = {1, 0, -1, 0};
|
||||
public static final int[] anIntArray144 = {0, -1, 0, 1};
|
||||
public static int randomHueOffset = (int) (Math.random() * 17.0) - 8;
|
||||
public static int anInt131;
|
||||
public static int level;
|
||||
public static int randomLightnessOffset = (int) (Math.random() * 33.0) - 16;
|
||||
public static int minLevel = 99;
|
||||
public static boolean lowmem = true;
|
||||
@@ -342,47 +342,66 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean method189(int i, byte[] is, int i_250_) {
|
||||
boolean bool = true;
|
||||
Buffer buffer = new Buffer(is);
|
||||
int i_252_ = -1;
|
||||
/**
|
||||
* Reads the Locs from the provided data and determines if their models are available. The origin coordinate is used
|
||||
* to determine if a loc would be excluded from the scene, therefor not required to be validated. The chain of calls
|
||||
* eventually invokes {@link Model#validate(int)} which causes the {@link OnDemand} to do its job.
|
||||
* @param data the data
|
||||
* @param originX the region origin x in the scene.
|
||||
* @param originZ the region origin z in the scene.
|
||||
* @return <code>true</code> if all locs are valid.
|
||||
*/
|
||||
public static boolean validateLocs(byte[] data, int originX, int originZ) {
|
||||
boolean ok = true;
|
||||
Buffer buffer = new Buffer(data);
|
||||
int locID = -1;
|
||||
|
||||
for (; ; ) {
|
||||
int i_253_ = buffer.readSmartU();
|
||||
if (i_253_ == 0) {
|
||||
int idDelta = buffer.readSmartU();
|
||||
if (idDelta == 0) {
|
||||
break;
|
||||
}
|
||||
i_252_ += i_253_;
|
||||
int i_254_ = 0;
|
||||
boolean bool_255_ = false;
|
||||
|
||||
locID += idDelta;
|
||||
|
||||
int coordinate = 0;
|
||||
boolean skip = false;
|
||||
|
||||
// this loop is for the same Loc ID.
|
||||
for (; ; ) {
|
||||
if (bool_255_) {
|
||||
int i_256_ = buffer.readSmartU();
|
||||
if (i_256_ == 0) {
|
||||
if (skip) {
|
||||
if (buffer.readSmartU() == 0) {
|
||||
break;
|
||||
}
|
||||
buffer.read8U();
|
||||
} else {
|
||||
int i_257_ = buffer.readSmartU();
|
||||
if (i_257_ == 0) {
|
||||
int coordinateDelta = buffer.readSmartU();
|
||||
|
||||
if (coordinateDelta == 0) {
|
||||
break;
|
||||
}
|
||||
i_254_ += i_257_ - 1;
|
||||
int i_258_ = i_254_ & 0x3f;
|
||||
int i_259_ = (i_254_ >> 6) & 0x3f;
|
||||
int i_260_ = buffer.read8U() >> 2;
|
||||
int i_261_ = i_259_ + i;
|
||||
int i_262_ = i_258_ + i_250_;
|
||||
if ((i_261_ > 0) && (i_262_ > 0) && (i_261_ < 103) && (i_262_ < 103)) {
|
||||
LocType type = LocType.get(i_252_);
|
||||
if ((i_260_ != 22) || !lowmem || type.interactable || type.important) {
|
||||
bool &= type.method579();
|
||||
bool_255_ = true;
|
||||
|
||||
coordinate += coordinateDelta - 1;
|
||||
|
||||
int z = coordinate & 0x3f;
|
||||
int x = (coordinate >> 6) & 0x3f;
|
||||
|
||||
int kind = buffer.read8U() >> 2;
|
||||
int localX = x + originX;
|
||||
int localZ = z + originZ;
|
||||
|
||||
if ((localX > 0) && (localZ > 0) && (localX < 103) && (localZ < 103)) {
|
||||
LocType type = LocType.get(locID);
|
||||
|
||||
if ((kind != 22) || !lowmem || type.interactable || type.important) {
|
||||
ok &= type.validate();
|
||||
skip = true; // Skip the remaining locs of this ID because we only need to validate the model of one.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bool;
|
||||
return ok;
|
||||
}
|
||||
|
||||
public final int[] blendChroma;
|
||||
@@ -427,7 +446,7 @@ public class SceneBuilder {
|
||||
randomize();
|
||||
|
||||
for (int level = 0; level < 4; level++) {
|
||||
buildTerrainLighting(level);
|
||||
buildLandscapeLighting(level);
|
||||
buildTiles(scene, level);
|
||||
updateDrawLevels(scene, level);
|
||||
}
|
||||
@@ -443,17 +462,19 @@ public class SceneBuilder {
|
||||
for (int x = 0; x < 104; x++) {
|
||||
for (int z = 0; z < 104; z++) {
|
||||
// solid?
|
||||
if ((levelTileFlags[level][x][z] & 0x1) == 1) {
|
||||
int trueLevel = level;
|
||||
if ((levelTileFlags[level][x][z] & 0x1) != 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// bridge
|
||||
if ((levelTileFlags[1][x][z] & 0x2) == 2) {
|
||||
trueLevel--;
|
||||
}
|
||||
int trueLevel = level;
|
||||
|
||||
if (trueLevel >= 0) {
|
||||
levelCollisionMaps[trueLevel].addSolid(z, x);
|
||||
}
|
||||
// bridge
|
||||
if ((levelTileFlags[1][x][z] & 0x2) == 2) {
|
||||
trueLevel--;
|
||||
}
|
||||
|
||||
if (trueLevel >= 0) {
|
||||
levelCollisionMaps[trueLevel].addSolid(z, x);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -561,102 +582,106 @@ public class SceneBuilder {
|
||||
magnitudeAccumulator -= blendMagnitude[dz2];
|
||||
}
|
||||
|
||||
if ((z0 >= 1) && (z0 < (maxTileZ - 1)) && (!lowmem || ((levelTileFlags[0][x0][z0] & 0x2) != 0) || (((levelTileFlags[level][x0][z0] & 0x10) == 0) && (getDrawLevel(level, x0, z0) == anInt131)))) {
|
||||
if (level < minLevel) {
|
||||
minLevel = level;
|
||||
if ((z0 < 1) || (z0 >= (maxTileZ - 1)) || (lowmem && ((levelTileFlags[0][x0][z0] & 0x2) == 0) && (((levelTileFlags[level][x0][z0] & 0x10) != 0) || (getDrawLevel(level, x0, z0) != SceneBuilder.level)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (level < minLevel) {
|
||||
minLevel = level;
|
||||
}
|
||||
|
||||
int underlayID = levelTileUnderlayIDs[level][x0][z0] & 0xff;
|
||||
int overlayID = levelTileOverlayIDs[level][x0][z0] & 0xff;
|
||||
|
||||
if ((underlayID <= 0) && (overlayID <= 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int heightSW = levelHeightmap[level][x0][z0];
|
||||
int heightSE = levelHeightmap[level][x0 + 1][z0];
|
||||
int heightNE = levelHeightmap[level][x0 + 1][z0 + 1];
|
||||
int heightNW = levelHeightmap[level][x0][z0 + 1];
|
||||
|
||||
int lightSW = levelLightmap[x0][z0];
|
||||
int lightSE = levelLightmap[x0 + 1][z0];
|
||||
int lightNE = levelLightmap[x0 + 1][z0 + 1];
|
||||
int lightNW = levelLightmap[x0][z0 + 1];
|
||||
|
||||
int baseColor = -1;
|
||||
int tintColor = -1;
|
||||
|
||||
if (underlayID > 0) {
|
||||
int hue = (hueAccumulator * 256) / luminanceAccumulator;
|
||||
int saturation = saturationAccumulator / magnitudeAccumulator;
|
||||
int lightness = lightnessAccumulator / magnitudeAccumulator;
|
||||
|
||||
baseColor = decimateHSL(hue, saturation, lightness);
|
||||
|
||||
hue = (hue + randomHueOffset) & 0xff;
|
||||
lightness += randomLightnessOffset;
|
||||
|
||||
if (lightness < 0) {
|
||||
lightness = 0;
|
||||
} else if (lightness > 255) {
|
||||
lightness = 255;
|
||||
}
|
||||
|
||||
int underlayID = levelTileUnderlayIDs[level][x0][z0] & 0xff;
|
||||
int overlayID = levelTileOverlayIDs[level][x0][z0] & 0xff;
|
||||
tintColor = decimateHSL(hue, saturation, lightness);
|
||||
}
|
||||
|
||||
if ((underlayID > 0) || (overlayID > 0)) {
|
||||
int heightSW = levelHeightmap[level][x0][z0];
|
||||
int heightSE = levelHeightmap[level][x0 + 1][z0];
|
||||
int heightNE = levelHeightmap[level][x0 + 1][z0 + 1];
|
||||
int heightNW = levelHeightmap[level][x0][z0 + 1];
|
||||
if (level > 0) {
|
||||
boolean occludes = true;
|
||||
|
||||
int lightSW = levelLightmap[x0][z0];
|
||||
int lightSE = levelLightmap[x0 + 1][z0];
|
||||
int lightNE = levelLightmap[x0 + 1][z0 + 1];
|
||||
int lightNW = levelLightmap[x0][z0 + 1];
|
||||
|
||||
int baseColor = -1;
|
||||
int tintColor = -1;
|
||||
|
||||
if (underlayID > 0) {
|
||||
int hue = (hueAccumulator * 256) / luminanceAccumulator;
|
||||
int saturation = saturationAccumulator / magnitudeAccumulator;
|
||||
int lightness = lightnessAccumulator / magnitudeAccumulator;
|
||||
|
||||
baseColor = decimateHSL(hue, saturation, lightness);
|
||||
|
||||
hue = (hue + randomHueOffset) & 0xff;
|
||||
lightness += randomLightnessOffset;
|
||||
|
||||
if (lightness < 0) {
|
||||
lightness = 0;
|
||||
} else if (lightness > 255) {
|
||||
lightness = 255;
|
||||
}
|
||||
|
||||
tintColor = decimateHSL(hue, saturation, lightness);
|
||||
}
|
||||
|
||||
if (level > 0) {
|
||||
boolean occludes = true;
|
||||
|
||||
if ((underlayID == 0) && (levelTileOverlayShape[level][x0][z0] != 0)) {
|
||||
occludes = false;
|
||||
}
|
||||
|
||||
if ((overlayID > 0) && !FloType.instances[overlayID - 1].occludes) {
|
||||
occludes = false;
|
||||
}
|
||||
|
||||
// occludes && flat
|
||||
if (occludes && (heightSW == heightSE) && (heightSW == heightNE) && (heightSW == heightNW)) {
|
||||
levelOccludemap[level][x0][z0] |= 0b100_100_100_100;
|
||||
}
|
||||
}
|
||||
|
||||
int shadeColor = 0;
|
||||
|
||||
if (baseColor != -1) {
|
||||
shadeColor = Draw3D.palette[mulHSL(tintColor, 96)];
|
||||
}
|
||||
|
||||
if (overlayID == 0) {
|
||||
scene.setTile(level, x0, z0, 0, 0, -1, heightSW, heightSE, heightNE, heightNW, mulHSL(baseColor, lightSW), mulHSL(baseColor, lightSE), mulHSL(baseColor, lightNE), mulHSL(baseColor, lightNW), 0, 0, 0, 0, shadeColor, 0);
|
||||
} else {
|
||||
int shape = levelTileOverlayShape[level][x0][z0] + 1;
|
||||
byte rotation = levelTileOverlayRotation[level][x0][z0];
|
||||
FloType flo = FloType.instances[overlayID - 1];
|
||||
int textureID = flo.textureID;
|
||||
int rgb;
|
||||
int hsl;
|
||||
|
||||
if (textureID >= 0) {
|
||||
rgb = Draw3D.getAverageTextureRGB(textureID);
|
||||
hsl = -1;
|
||||
} else if (flo.rgb == 16711935) {
|
||||
rgb = 0;
|
||||
hsl = -2;
|
||||
textureID = -1;
|
||||
} else {
|
||||
hsl = decimateHSL(flo.hue, flo.saturation, flo.lightness);
|
||||
rgb = Draw3D.palette[adjustLightness(flo.hsl, 96)];
|
||||
}
|
||||
|
||||
scene.setTile(level, x0, z0, shape, rotation, textureID, heightSW, heightSE, heightNE, heightNW, mulHSL(baseColor, lightSW), mulHSL(baseColor, lightSE), mulHSL(baseColor, lightNE), mulHSL(baseColor, lightNW), adjustLightness(hsl, lightSW), adjustLightness(hsl, lightSE), adjustLightness(hsl, lightNE), adjustLightness(hsl, lightNW), shadeColor, rgb);
|
||||
}
|
||||
if ((underlayID == 0) && (levelTileOverlayShape[level][x0][z0] != 0)) {
|
||||
occludes = false;
|
||||
}
|
||||
|
||||
if ((overlayID > 0) && !FloType.instances[overlayID - 1].occludes) {
|
||||
occludes = false;
|
||||
}
|
||||
|
||||
// occludes && flat
|
||||
if (occludes && (heightSW == heightSE) && (heightSW == heightNE) && (heightSW == heightNW)) {
|
||||
levelOccludemap[level][x0][z0] |= 0b100_100_100_100;
|
||||
}
|
||||
}
|
||||
|
||||
int shadeColor = 0;
|
||||
|
||||
if (baseColor != -1) {
|
||||
shadeColor = Draw3D.palette[mulHSL(tintColor, 96)];
|
||||
}
|
||||
|
||||
if (overlayID == 0) {
|
||||
scene.setTile(level, x0, z0, 0, 0, -1, heightSW, heightSE, heightNE, heightNW, mulHSL(baseColor, lightSW), mulHSL(baseColor, lightSE), mulHSL(baseColor, lightNE), mulHSL(baseColor, lightNW), 0, 0, 0, 0, shadeColor, 0);
|
||||
} else {
|
||||
int shape = levelTileOverlayShape[level][x0][z0] + 1;
|
||||
byte rotation = levelTileOverlayRotation[level][x0][z0];
|
||||
FloType flo = FloType.instances[overlayID - 1];
|
||||
int textureID = flo.textureID;
|
||||
int rgb;
|
||||
int hsl;
|
||||
|
||||
if (textureID >= 0) {
|
||||
rgb = Draw3D.getAverageTextureRGB(textureID);
|
||||
hsl = -1;
|
||||
} else if (flo.rgb == 16711935) {
|
||||
rgb = 0;
|
||||
hsl = -2;
|
||||
textureID = -1;
|
||||
} else {
|
||||
hsl = decimateHSL(flo.hue, flo.saturation, flo.lightness);
|
||||
rgb = Draw3D.palette[adjustLightness(flo.hsl, 96)];
|
||||
}
|
||||
|
||||
scene.setTile(level, x0, z0, shape, rotation, textureID, heightSW, heightSE, heightNE, heightNW, mulHSL(baseColor, lightSW), mulHSL(baseColor, lightSE), mulHSL(baseColor, lightNE), mulHSL(baseColor, lightNW), adjustLightness(hsl, lightSW), adjustLightness(hsl, lightSE), adjustLightness(hsl, lightNE), adjustLightness(hsl, lightNW), shadeColor, rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buildTerrainLighting(int level) {
|
||||
private void buildLandscapeLighting(int level) {
|
||||
byte[][] shademap = levelShademap[level];
|
||||
int lightAmbient = 96;
|
||||
int lightAttenuation = 768;
|
||||
@@ -753,7 +778,7 @@ public class SceneBuilder {
|
||||
if ((((maxTileX - minTileX) + 1) * ((maxTileZ - minTileZ) + 1)) >= 4) {
|
||||
int y = levelHeightmap[level][minTileX][minTileZ];
|
||||
|
||||
Scene.addOccluder(top, minTileX * 128, y, (maxTileX * 128) + 128, (maxTileZ * 128) + 128, y, minTileZ * 128, 4);
|
||||
Scene.addOccluder(top, minTileX * 128, y, minTileZ * 128, (maxTileX * 128) + 128, y, (maxTileZ * 128) + 128, 4);
|
||||
|
||||
for (int x = minTileX; x <= maxTileX; x++) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
@@ -806,7 +831,7 @@ public class SceneBuilder {
|
||||
int minY = levelHeightmap[maxLevel][minTileX][tileZ] - 240;
|
||||
int maxY = levelHeightmap[minLevel][minTileX][tileZ];
|
||||
|
||||
Scene.addOccluder(top, minTileX * 128, maxY, (maxTileX * 128) + 128, tileZ * 128, minY, tileZ * 128, 2);
|
||||
Scene.addOccluder(top, minTileX * 128, minY, tileZ * 128, (maxTileX * 128) + 128, maxY, tileZ * 128, 2);
|
||||
|
||||
for (int l = minLevel; l <= maxLevel; l++) {
|
||||
for (int x = minTileX; x <= maxTileX; x++) {
|
||||
@@ -860,7 +885,7 @@ public class SceneBuilder {
|
||||
int minY = levelHeightmap[maxLevel][tileX][minTileZ] - 240;
|
||||
int maxY = levelHeightmap[minLevel][tileX][minTileZ];
|
||||
|
||||
Scene.addOccluder(top, tileX * 128, maxY, tileX * 128, (maxTileZ * 128) + 128, minY, minTileZ * 128, 1);
|
||||
Scene.addOccluder(top, tileX * 128, minY, minTileZ * 128, tileX * 128, maxY, (maxTileZ * 128) + 128, 1);
|
||||
|
||||
for (int l = minLevel; l <= maxLevel; l++) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
@@ -894,7 +919,7 @@ public class SceneBuilder {
|
||||
}
|
||||
|
||||
public void method175(int z, Scene scene, SceneCollisionMap collision, int kind, int level, int x, int locID, int rotation) {
|
||||
if (lowmem && ((levelTileFlags[0][x][z] & 0x2) == 0) && (((levelTileFlags[level][x][z] & 0x10) != 0) || (getDrawLevel(level, x, z) != anInt131))) {
|
||||
if (lowmem && ((levelTileFlags[0][x][z] & 0x2) == 0) && (((levelTileFlags[level][x][z] & 0x10) != 0) || (getDrawLevel(level, x, z) != SceneBuilder.level))) {
|
||||
return;
|
||||
}
|
||||
if (level < minLevel) {
|
||||
|
||||
+13
-13
@@ -33,12 +33,12 @@ public class SeqType {
|
||||
* The list of {@link SeqTransform} indices indexed by Frame ID.
|
||||
* @see SeqTransform
|
||||
*/
|
||||
public int[] transformIndices;
|
||||
public int[] transformIDs;
|
||||
|
||||
/**
|
||||
* Auxiliary transform indices appear to only be used by a {@link Component} of type <code>6</code> as seen in {@link Game#drawParentComponent(Component, int, int, int)}.
|
||||
*/
|
||||
public int[] auxiliaryTransformIndices;
|
||||
public int[] auxiliaryTransformIDs;
|
||||
|
||||
/**
|
||||
* A list of durations indexed by Frame ID.
|
||||
@@ -116,7 +116,7 @@ public class SeqType {
|
||||
int duration = frameDuration[frame];
|
||||
|
||||
if (duration == 0) {
|
||||
SeqTransform transform = SeqTransform.get(transformIndices[frame]);
|
||||
SeqTransform transform = SeqTransform.get(transformIDs[frame]);
|
||||
if (transform != null) {
|
||||
duration = frameDuration[frame] = transform.delay;
|
||||
}
|
||||
@@ -136,14 +136,14 @@ public class SeqType {
|
||||
break;
|
||||
} else if (op == 1) {
|
||||
frameCount = buffer.read8U();
|
||||
transformIndices = new int[frameCount];
|
||||
auxiliaryTransformIndices = new int[frameCount];
|
||||
transformIDs = new int[frameCount];
|
||||
auxiliaryTransformIDs = new int[frameCount];
|
||||
frameDuration = new int[frameCount];
|
||||
for (int f = 0; f < frameCount; f++) {
|
||||
transformIndices[f] = buffer.read16U();
|
||||
auxiliaryTransformIndices[f] = buffer.read16U();
|
||||
if (auxiliaryTransformIndices[f] == 65535) {
|
||||
auxiliaryTransformIndices[f] = -1;
|
||||
transformIDs[f] = buffer.read16U();
|
||||
auxiliaryTransformIDs[f] = buffer.read16U();
|
||||
if (auxiliaryTransformIDs[f] == 65535) {
|
||||
auxiliaryTransformIDs[f] = -1;
|
||||
}
|
||||
frameDuration[f] = buffer.read16U();
|
||||
}
|
||||
@@ -181,10 +181,10 @@ public class SeqType {
|
||||
|
||||
if (frameCount == 0) {
|
||||
frameCount = 1;
|
||||
transformIndices = new int[1];
|
||||
transformIndices[0] = -1;
|
||||
auxiliaryTransformIndices = new int[1];
|
||||
auxiliaryTransformIndices[0] = -1;
|
||||
transformIDs = new int[1];
|
||||
transformIDs[0] = -1;
|
||||
auxiliaryTransformIDs = new int[1];
|
||||
auxiliaryTransformIDs[0] = -1;
|
||||
frameDuration = new int[1];
|
||||
frameDuration[0] = -1;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SpotAnimEntity extends Entity {
|
||||
return null;
|
||||
}
|
||||
|
||||
int transformID = type.seq.transformIndices[seqFrame];
|
||||
int transformID = type.seq.transformIDs[seqFrame];
|
||||
|
||||
Model model = new Model(true, SeqTransform.isNull(transformID), false, base);
|
||||
|
||||
|
||||
Reference in new issue
Block a user