Loc/Zone Packets (Partial)
This commit is contained in:
1 parent
ac3938c306
commit
e5438f79a4
14 files changed
+2851
-2648
No files matched your search
@@ -164,14 +164,14 @@ public class Component {
|
||||
if (c.type == 6) {
|
||||
int tmp = in.get1U();
|
||||
if (tmp != 0) {
|
||||
c.modelType = 1;
|
||||
c.modelTypeId = ((tmp - 1) << 8) + in.get1U();
|
||||
c.modelCategory = 1;
|
||||
c.modelID = ((tmp - 1) << 8) + in.get1U();
|
||||
}
|
||||
|
||||
tmp = in.get1U();
|
||||
if (tmp != 0) {
|
||||
c.activeModelType = 1;
|
||||
c.activeModelTypeId = ((tmp - 1) << 8) + in.get1U();
|
||||
c.activeModelCategory = 1;
|
||||
c.activeModelID = ((tmp - 1) << 8) + in.get1U();
|
||||
}
|
||||
|
||||
tmp = in.get1U();
|
||||
@@ -269,8 +269,8 @@ public class Component {
|
||||
public int activeColor;
|
||||
public int activeHoverColor;
|
||||
public Image24 activeImage;
|
||||
public int activeModelType;
|
||||
public int activeModelTypeId;
|
||||
public int activeModelCategory;
|
||||
public int activeModelID;
|
||||
public int activeSeqId;
|
||||
public String activeText;
|
||||
public boolean center;
|
||||
@@ -299,8 +299,8 @@ public class Component {
|
||||
public int[] invSlotY;
|
||||
public boolean invUsable;
|
||||
public int modelEyePitch;
|
||||
public int modelType;
|
||||
public int modelTypeId;
|
||||
public int modelCategory;
|
||||
public int modelID;
|
||||
public int modelYaw;
|
||||
public int modelZoom;
|
||||
public String option;
|
||||
@@ -341,28 +341,28 @@ public class Component {
|
||||
invSlotAmount[dst] = tmp;
|
||||
}
|
||||
|
||||
public Model getModel(int type, int id) {
|
||||
Model model = modelCache.get(((long) type << 16) + id);
|
||||
public Model getModel(int category, int id) {
|
||||
Model model = modelCache.get(((long) category << 16) + id);
|
||||
if (model != null) {
|
||||
return model;
|
||||
}
|
||||
if (type == 1) {
|
||||
if (category == 1) {
|
||||
model = Model.tryGet(id);
|
||||
}
|
||||
if (type == 2) {
|
||||
if (category == 2) {
|
||||
model = NPCType.get(id).method160();
|
||||
}
|
||||
if (type == 3) {
|
||||
model = Game.self.method453();
|
||||
if (category == 3) {
|
||||
model = Game.localPlayer.method453();
|
||||
}
|
||||
if (type == 4) {
|
||||
if (category == 4) {
|
||||
model = ObjType.get(id).getModelUnlit(50);
|
||||
}
|
||||
if (type == 5) {
|
||||
if (category == 5) {
|
||||
model = null;
|
||||
}
|
||||
if (model != null) {
|
||||
modelCache.put((long) ((type << 16) + id), model);
|
||||
modelCache.put((long) ((category << 16) + id), model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
@@ -371,9 +371,9 @@ public class Component {
|
||||
Model model;
|
||||
|
||||
if (active) {
|
||||
model = getModel(activeModelType, activeModelTypeId);
|
||||
model = getModel(activeModelCategory, activeModelID);
|
||||
} else {
|
||||
model = getModel(modelType, modelTypeId);
|
||||
model = getModel(modelCategory, modelID);
|
||||
}
|
||||
|
||||
if (model == null) {
|
||||
|
||||
+656
-572
File diff suppressed because it is too large.
Load diff
@@ -11,7 +11,7 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
|
||||
public final long[] otim = new long[10];
|
||||
public final int[] actionKey = new int[128];
|
||||
public final int[] anIntArray31 = new int[128];
|
||||
public final int[] keyQueue = new int[128];
|
||||
public int state;
|
||||
public int deltime = 20;
|
||||
public int mindel = 1;
|
||||
@@ -22,7 +22,7 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
public Graphics graphics;
|
||||
public GameFrame frame;
|
||||
public boolean refresh = true;
|
||||
public boolean aBoolean17 = true;
|
||||
public boolean focused = true;
|
||||
public int idleCycles;
|
||||
public int mouseButton;
|
||||
public int mouseX;
|
||||
@@ -35,8 +35,8 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
public int mousePressX;
|
||||
public int mousePressY;
|
||||
public long mousePressTime;
|
||||
public int anInt32;
|
||||
public int anInt33;
|
||||
public int keyQueueReadPos;
|
||||
public int keyQueueWritePos;
|
||||
|
||||
public void init(int width, int height) {
|
||||
screenWidth = width;
|
||||
@@ -146,7 +146,7 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
mousePressTime = lastMousePressTime;
|
||||
lastMousePressButton = 0;
|
||||
update();
|
||||
anInt32 = anInt33;
|
||||
keyQueueReadPos = keyQueueWritePos;
|
||||
}
|
||||
|
||||
count &= 0xff;
|
||||
@@ -293,49 +293,49 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
public void keyPressed(KeyEvent e) {
|
||||
idleCycles = 0;
|
||||
int code = e.getKeyCode();
|
||||
int ch = e.getKeyChar();
|
||||
int value = e.getKeyChar();
|
||||
|
||||
if (ch < 30) {
|
||||
ch = 0;
|
||||
if (value < 30) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
if (code == KeyEvent.VK_LEFT) {
|
||||
ch = 1;
|
||||
value = 1;
|
||||
} else if (code == KeyEvent.VK_RIGHT) {
|
||||
ch = 2;
|
||||
value = 2;
|
||||
} else if (code == KeyEvent.VK_UP) {
|
||||
ch = 3;
|
||||
value = 3;
|
||||
} else if (code == KeyEvent.VK_DOWN) {
|
||||
ch = 4;
|
||||
value = 4;
|
||||
} else if (code == KeyEvent.VK_CONTROL) {
|
||||
ch = 5;
|
||||
value = 5;
|
||||
} else if (code == KeyEvent.VK_BACK_SPACE) {
|
||||
ch = 8;
|
||||
value = 8;
|
||||
} else if (code == KeyEvent.VK_DELETE) {
|
||||
ch = 8;
|
||||
value = 8;
|
||||
} else if (code == KeyEvent.VK_TAB) {
|
||||
ch = 9;
|
||||
value = 9;
|
||||
} else if (code == KeyEvent.VK_ENTER) {
|
||||
ch = 10;
|
||||
value = 10;
|
||||
} else if ((code >= KeyEvent.VK_F1) && (code <= KeyEvent.VK_F12)) {
|
||||
ch = (1008 + code) - KeyEvent.VK_F1;
|
||||
value = (1008 + code) - KeyEvent.VK_F1;
|
||||
} else if (code == KeyEvent.VK_HOME) {
|
||||
ch = 1000;
|
||||
value = 1000;
|
||||
} else if (code == KeyEvent.VK_END) {
|
||||
ch = 1001;
|
||||
value = 1001;
|
||||
} else if (code == KeyEvent.VK_PAGE_UP) {
|
||||
ch = 1002;
|
||||
value = 1002;
|
||||
} else if (code == KeyEvent.VK_PAGE_DOWN) {
|
||||
ch = 1003;
|
||||
value = 1003;
|
||||
}
|
||||
|
||||
if ((ch > 0) && (ch < 128)) {
|
||||
actionKey[ch] = 1;
|
||||
if ((value > 0) && (value < 128)) {
|
||||
actionKey[value] = 1;
|
||||
}
|
||||
|
||||
if (ch > 4) {
|
||||
anIntArray31[anInt33] = ch;
|
||||
anInt33 = (anInt33 + 1) & 0x7f;
|
||||
if (value > 4) {
|
||||
keyQueue[keyQueueWritePos] = value;
|
||||
keyQueueWritePos = (keyQueueWritePos + 1) & 0x7f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,23 +381,23 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
|
||||
public int pollKey() {
|
||||
int key = -1;
|
||||
if (anInt33 != anInt32) {
|
||||
key = anIntArray31[anInt32];
|
||||
anInt32 = (anInt32 + 1) & 0x7f;
|
||||
if (keyQueueWritePos != keyQueueReadPos) {
|
||||
key = keyQueue[keyQueueReadPos];
|
||||
keyQueueReadPos = (keyQueueReadPos + 1) & 0x7f;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
aBoolean17 = true;
|
||||
focused = true;
|
||||
refresh = true;
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
aBoolean17 = false;
|
||||
focused = false;
|
||||
for (int i = 0; i < 128; i++) {
|
||||
actionKey[i] = 0;
|
||||
}
|
||||
|
||||
@@ -5,98 +5,113 @@
|
||||
public class LocEntity extends Entity {
|
||||
|
||||
public static Game game;
|
||||
public final int[] anIntArray1600;
|
||||
public final int anInt1601;
|
||||
public final int anInt1602;
|
||||
public final int anInt1603;
|
||||
public final int anInt1604;
|
||||
public final int anInt1605;
|
||||
public final int anInt1606;
|
||||
public final int anInt1610;
|
||||
public final int anInt1611;
|
||||
public final int anInt1612;
|
||||
public int anInt1599;
|
||||
public SeqType aType_1607;
|
||||
public int anInt1608;
|
||||
public final int[] overrideTypeIDs;
|
||||
public final int varbit;
|
||||
public final int varp;
|
||||
public final int heightmapSW;
|
||||
public final int heightmapSE;
|
||||
public final int heightmapNE;
|
||||
public final int heightmapNW;
|
||||
public final int id;
|
||||
public final int kind;
|
||||
public final int rotation;
|
||||
public int seqFrame;
|
||||
public SeqType seq;
|
||||
public int seqCycle;
|
||||
|
||||
public LocEntity(int i, int j, int k, int l, int i1, int j1, int k1, int l1, boolean flag) {
|
||||
anInt1610 = i;
|
||||
anInt1611 = k;
|
||||
anInt1612 = j;
|
||||
anInt1603 = j1;
|
||||
anInt1604 = l;
|
||||
anInt1605 = i1;
|
||||
anInt1606 = k1;
|
||||
if (l1 != -1) {
|
||||
aType_1607 = SeqType.instances[l1];
|
||||
anInt1599 = 0;
|
||||
anInt1608 = Game.loopCycle;
|
||||
if (flag && (aType_1607.anInt356 != -1)) {
|
||||
anInt1599 = (int) (Math.random() * (double) aType_1607.frameCount);
|
||||
anInt1608 -= (int) (Math.random() * (double) aType_1607.getFrameDelay(anInt1599));
|
||||
public LocEntity(int id, int rotation, int kind, int heightmapSE, int heightmapNE, int heightmapSW, int heightmapNW, int seqID, boolean randomFrame) {
|
||||
this.id = id;
|
||||
this.kind = kind;
|
||||
this.rotation = rotation;
|
||||
this.heightmapSW = heightmapSW;
|
||||
this.heightmapSE = heightmapSE;
|
||||
this.heightmapNE = heightmapNE;
|
||||
this.heightmapNW = heightmapNW;
|
||||
|
||||
if (seqID != -1) {
|
||||
seq = SeqType.instances[seqID];
|
||||
seqFrame = 0;
|
||||
seqCycle = Game.loopCycle;
|
||||
|
||||
if (randomFrame && (seq.speed != -1)) {
|
||||
seqFrame = (int) (Math.random() * (double) seq.frameCount);
|
||||
seqCycle -= (int) (Math.random() * (double) seq.getFrameDelay(seqFrame));
|
||||
}
|
||||
}
|
||||
LocType type = LocType.get(anInt1610);
|
||||
anInt1601 = type.varbit;
|
||||
anInt1602 = type.varp;
|
||||
anIntArray1600 = type.overrideIds;
|
||||
LocType type = LocType.get(this.id);
|
||||
varbit = type.varbit;
|
||||
varp = type.varp;
|
||||
overrideTypeIDs = type.overrideTypeIDs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel() {
|
||||
int j = -1;
|
||||
if (aType_1607 != null) {
|
||||
int k = Game.loopCycle - anInt1608;
|
||||
if ((k > 100) && (aType_1607.anInt356 > 0)) {
|
||||
k = 100;
|
||||
int frame = -1;
|
||||
|
||||
if (seq != null) {
|
||||
int delta = Game.loopCycle - seqCycle;
|
||||
|
||||
if ((delta > 100) && (seq.speed > 0)) {
|
||||
delta = 100;
|
||||
}
|
||||
while (k > aType_1607.getFrameDelay(anInt1599)) {
|
||||
k -= aType_1607.getFrameDelay(anInt1599);
|
||||
anInt1599++;
|
||||
if (anInt1599 < aType_1607.frameCount) {
|
||||
|
||||
while (delta > seq.getFrameDelay(seqFrame)) {
|
||||
delta -= seq.getFrameDelay(seqFrame);
|
||||
seqFrame++;
|
||||
|
||||
if (seqFrame < seq.frameCount) {
|
||||
continue;
|
||||
}
|
||||
anInt1599 -= aType_1607.anInt356;
|
||||
if ((anInt1599 >= 0) && (anInt1599 < aType_1607.frameCount)) {
|
||||
|
||||
seqFrame -= seq.speed;
|
||||
|
||||
if ((seqFrame >= 0) && (seqFrame < seq.frameCount)) {
|
||||
continue;
|
||||
}
|
||||
aType_1607 = null;
|
||||
|
||||
seq = null;
|
||||
break;
|
||||
}
|
||||
anInt1608 = Game.loopCycle - k;
|
||||
if (aType_1607 != null) {
|
||||
j = aType_1607.primaryFrames[anInt1599];
|
||||
seqCycle = Game.loopCycle - delta;
|
||||
|
||||
if (seq != null) {
|
||||
frame = seq.primaryFrames[seqFrame];
|
||||
}
|
||||
}
|
||||
|
||||
LocType type;
|
||||
if (anIntArray1600 != null) {
|
||||
type = method457();
|
||||
|
||||
if (overrideTypeIDs != null) {
|
||||
type = getOverrideType();
|
||||
} else {
|
||||
type = LocType.get(anInt1610);
|
||||
type = LocType.get(id);
|
||||
}
|
||||
|
||||
if (type == null) {
|
||||
return null;
|
||||
} else {
|
||||
return type.method578(anInt1611, anInt1612, anInt1603, anInt1604, anInt1605, anInt1606, j);
|
||||
return type.getModel(kind, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, frame);
|
||||
}
|
||||
}
|
||||
|
||||
public LocType method457() {
|
||||
int i = -1;
|
||||
if (anInt1601 != -1) {
|
||||
VarbitType varbit = VarbitType.instances[anInt1601];
|
||||
int k = varbit.varp;
|
||||
int l = varbit.lsb;
|
||||
int i1 = varbit.msb;
|
||||
int j1 = Game.BITMASK[i1 - l];
|
||||
i = (game.variables[k] >> l) & j1;
|
||||
} else if (anInt1602 != -1) {
|
||||
i = game.variables[anInt1602];
|
||||
public LocType getOverrideType() {
|
||||
int value = -1;
|
||||
|
||||
if (varbit != -1) {
|
||||
VarbitType varbit = VarbitType.instances[this.varbit];
|
||||
int varp = varbit.varp;
|
||||
int low = varbit.lsb;
|
||||
int high = varbit.msb;
|
||||
int mask = Game.BITMASK[high - low];
|
||||
value = (game.variables[varp] >> low) & mask;
|
||||
} else if (varp != -1) {
|
||||
value = game.variables[varp];
|
||||
}
|
||||
if ((i < 0) || (i >= anIntArray1600.length) || (anIntArray1600[i] == -1)) {
|
||||
|
||||
if ((value < 0) || (value >= overrideTypeIDs.length) || (overrideTypeIDs[value] == -1)) {
|
||||
return null;
|
||||
} else {
|
||||
return LocType.get(anIntArray1600[i]);
|
||||
return LocType.get(overrideTypeIDs[value]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+498
-467
@@ -8,497 +8,528 @@ import java.io.IOException;
|
||||
|
||||
public class LocType {
|
||||
|
||||
public static final Model[] TMP_MODELS = new Model[4];
|
||||
public static boolean lowmem;
|
||||
public static Buffer dat;
|
||||
public static int[] offsets;
|
||||
public static int count;
|
||||
public static Game game;
|
||||
public static int anInt771;
|
||||
public static LRUMap<Long, Model> aCache_780 = new LRUMap(30);
|
||||
public static LocType[] cache;
|
||||
public static LRUMap<Long, Model> modelCache = new LRUMap(500);
|
||||
public static final Model[] TMP_MODELS = new Model[4];
|
||||
public static boolean lowmem;
|
||||
public static Buffer dat;
|
||||
public static int[] offsets;
|
||||
public static int count;
|
||||
public static Game game;
|
||||
public static int anInt771;
|
||||
/**
|
||||
* This is where dynamically generated models go.
|
||||
*/
|
||||
public static LRUMap<Long, Model> dynamicCache = new LRUMap(30);
|
||||
public static LocType[] cache;
|
||||
/**
|
||||
* This is where basic models go.
|
||||
*/
|
||||
public static LRUMap<Long, Model> staticCache = new LRUMap(500);
|
||||
|
||||
public static LocType get(int i) {
|
||||
if (i >= count) {
|
||||
i = 0;
|
||||
}
|
||||
for (int j = 0; j < 20; j++) {
|
||||
if (cache[j].index == i) {
|
||||
return cache[j];
|
||||
}
|
||||
}
|
||||
anInt771 = (anInt771 + 1) % 20;
|
||||
LocType type = cache[anInt771];
|
||||
dat.position = offsets[i];
|
||||
type.index = i;
|
||||
type.reset();
|
||||
type.method582(dat);
|
||||
return type;
|
||||
}
|
||||
public static LocType get(int i) {
|
||||
if (i >= count) {
|
||||
i = 0;
|
||||
}
|
||||
for (int j = 0; j < 20; j++) {
|
||||
if (cache[j].index == i) {
|
||||
return cache[j];
|
||||
}
|
||||
}
|
||||
anInt771 = (anInt771 + 1) % 20;
|
||||
LocType type = cache[anInt771];
|
||||
dat.position = offsets[i];
|
||||
type.index = i;
|
||||
type.reset();
|
||||
type.method582(dat);
|
||||
return type;
|
||||
}
|
||||
|
||||
public static void unload() {
|
||||
modelCache = null;
|
||||
aCache_780 = null;
|
||||
offsets = null;
|
||||
cache = null;
|
||||
dat = null;
|
||||
}
|
||||
public static void unload() {
|
||||
staticCache = null;
|
||||
dynamicCache = null;
|
||||
offsets = null;
|
||||
cache = null;
|
||||
dat = null;
|
||||
}
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
dat = new Buffer(archive.read("loc.dat"));
|
||||
Buffer buffer = new Buffer(archive.read("loc.idx"));
|
||||
count = buffer.get2U();
|
||||
offsets = new int[count];
|
||||
int i = 2;
|
||||
for (int j = 0; j < count; j++) {
|
||||
offsets[j] = i;
|
||||
i += buffer.get2U();
|
||||
}
|
||||
cache = new LocType[20];
|
||||
for (int k = 0; k < 20; k++) {
|
||||
cache[k] = new LocType();
|
||||
}
|
||||
}
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
dat = new Buffer(archive.read("loc.dat"));
|
||||
Buffer buffer = new Buffer(archive.read("loc.idx"));
|
||||
count = buffer.get2U();
|
||||
offsets = new int[count];
|
||||
int i = 2;
|
||||
for (int j = 0; j < count; j++) {
|
||||
offsets[j] = i;
|
||||
i += buffer.get2U();
|
||||
}
|
||||
cache = new LocType[20];
|
||||
for (int k = 0; k < 20; k++) {
|
||||
cache[k] = new LocType();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean important;
|
||||
public byte lightAmbient;
|
||||
public int translateX;
|
||||
public String name;
|
||||
public int scaleY;
|
||||
public byte lightAttenuation;
|
||||
public int width;
|
||||
public int translateY;
|
||||
public int mapfunctionIcon;
|
||||
public int[] dstColor;
|
||||
public int scaleX;
|
||||
public int varp;
|
||||
public boolean invert;
|
||||
public int index = -1;
|
||||
public boolean blocksProjectiles;
|
||||
public int mapsceneIcon;
|
||||
public int[] overrideIds;
|
||||
public int supportsObj;
|
||||
public int length;
|
||||
public boolean adjustToTerrain;
|
||||
public boolean occludes;
|
||||
public boolean decorative;
|
||||
public boolean solid;
|
||||
public int interactionSideFlags;
|
||||
/**
|
||||
* Models flagged as <code>dynamic</code> will <b>always</b> copy their models face information by making <code>copyFaces</code>
|
||||
* equal <code>true</code>.
|
||||
*
|
||||
* @see Model#Model(boolean, boolean, Model)
|
||||
*/
|
||||
public boolean dynamic;
|
||||
public int scaleZ;
|
||||
public int[] modelIds;
|
||||
public int varbit;
|
||||
public int decorationPadding;
|
||||
public int[] modelTypes;
|
||||
public String description;
|
||||
public boolean interactable;
|
||||
public boolean castShadow;
|
||||
public int seqId;
|
||||
public int translateZ;
|
||||
public int[] srcColor;
|
||||
public String[] actions;
|
||||
public boolean important;
|
||||
public byte lightAmbient;
|
||||
public int translateX;
|
||||
public String name;
|
||||
public int scaleY;
|
||||
public byte lightAttenuation;
|
||||
public int width;
|
||||
public int translateY;
|
||||
public int mapfunctionIcon;
|
||||
public int[] dstColor;
|
||||
public int scaleX;
|
||||
public int varp;
|
||||
public boolean invert;
|
||||
public int index = -1;
|
||||
public boolean blocksProjectiles;
|
||||
public int mapsceneIcon;
|
||||
public int[] overrideTypeIDs;
|
||||
public int supportsObj;
|
||||
public int length;
|
||||
public boolean adjustToTerrain;
|
||||
public boolean occludes;
|
||||
public boolean decorative;
|
||||
public boolean solid;
|
||||
public int interactionSideFlags;
|
||||
/**
|
||||
* Models flagged as <code>dynamic</code> will <b>always</b> copy their models face information by making <code>copyFaces</code>
|
||||
* equal <code>true</code>.
|
||||
*
|
||||
* @see Model#Model(boolean, boolean, Model)
|
||||
*/
|
||||
public boolean dynamic;
|
||||
public int scaleZ;
|
||||
public int[] modelIDs;
|
||||
public int varbit;
|
||||
public int decorationPadding;
|
||||
public int[] modelKinds;
|
||||
public String description;
|
||||
public boolean interactable;
|
||||
public boolean castShadow;
|
||||
public int seqId;
|
||||
public int translateZ;
|
||||
public int[] srcColor;
|
||||
public String[] actions;
|
||||
|
||||
public LocType() {
|
||||
}
|
||||
public LocType() {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
modelIds = null;
|
||||
modelTypes = null;
|
||||
name = null;
|
||||
description = null;
|
||||
srcColor = null;
|
||||
dstColor = null;
|
||||
width = 1;
|
||||
length = 1;
|
||||
solid = true;
|
||||
blocksProjectiles = true;
|
||||
interactable = false;
|
||||
adjustToTerrain = false;
|
||||
dynamic = false;
|
||||
occludes = false;
|
||||
seqId = -1;
|
||||
decorationPadding = 16;
|
||||
lightAmbient = 0;
|
||||
lightAttenuation = 0;
|
||||
actions = null;
|
||||
mapfunctionIcon = -1;
|
||||
mapsceneIcon = -1;
|
||||
invert = false;
|
||||
castShadow = true;
|
||||
scaleX = 128;
|
||||
scaleZ = 128;
|
||||
scaleY = 128;
|
||||
interactionSideFlags = 0;
|
||||
translateX = 0;
|
||||
translateY = 0;
|
||||
translateZ = 0;
|
||||
important = false;
|
||||
decorative = false;
|
||||
supportsObj = -1;
|
||||
varbit = -1;
|
||||
varp = -1;
|
||||
overrideIds = null;
|
||||
}
|
||||
public void reset() {
|
||||
modelIDs = null;
|
||||
modelKinds = null;
|
||||
name = null;
|
||||
description = null;
|
||||
srcColor = null;
|
||||
dstColor = null;
|
||||
width = 1;
|
||||
length = 1;
|
||||
solid = true;
|
||||
blocksProjectiles = true;
|
||||
interactable = false;
|
||||
adjustToTerrain = false;
|
||||
dynamic = false;
|
||||
occludes = false;
|
||||
seqId = -1;
|
||||
decorationPadding = 16;
|
||||
lightAmbient = 0;
|
||||
lightAttenuation = 0;
|
||||
actions = null;
|
||||
mapfunctionIcon = -1;
|
||||
mapsceneIcon = -1;
|
||||
invert = false;
|
||||
castShadow = true;
|
||||
scaleX = 128;
|
||||
scaleZ = 128;
|
||||
scaleY = 128;
|
||||
interactionSideFlags = 0;
|
||||
translateX = 0;
|
||||
translateY = 0;
|
||||
translateZ = 0;
|
||||
important = false;
|
||||
decorative = false;
|
||||
supportsObj = -1;
|
||||
varbit = -1;
|
||||
varp = -1;
|
||||
overrideTypeIDs = null;
|
||||
}
|
||||
|
||||
public void method574(OnDemand onDemand) {
|
||||
if (modelIds == null) {
|
||||
return;
|
||||
}
|
||||
for (int k : modelIds) {
|
||||
onDemand.method560(k & 0xffff, 0);
|
||||
}
|
||||
}
|
||||
public void method574(OnDemand onDemand) {
|
||||
if (modelIDs == null) {
|
||||
return;
|
||||
}
|
||||
for (int k : modelIDs) {
|
||||
onDemand.method560(k & 0xffff, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean method577(int i) {
|
||||
if (modelTypes == null) {
|
||||
if (modelIds == null) {
|
||||
return true;
|
||||
}
|
||||
if (i != 10) {
|
||||
return true;
|
||||
}
|
||||
boolean flag1 = true;
|
||||
for (int j : modelIds) {
|
||||
flag1 &= Model.validate(j & 0xffff);
|
||||
}
|
||||
return flag1;
|
||||
}
|
||||
for (int j = 0; j < modelTypes.length; j++) {
|
||||
if (modelTypes[j] == i) {
|
||||
return Model.validate(modelIds[j] & 0xffff);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean validate(int kind) {
|
||||
if (modelKinds == null) {
|
||||
if (modelIDs == null) {
|
||||
return true;
|
||||
}
|
||||
if (kind != 10) {
|
||||
return true;
|
||||
}
|
||||
boolean valid = true;
|
||||
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 true;
|
||||
}
|
||||
|
||||
public Model method578(int i, int j, int k, int l, int i1, int j1, int k1) {
|
||||
Model model = method581(i, k1, j);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (adjustToTerrain || dynamic) {
|
||||
model = new Model(adjustToTerrain, dynamic, model);
|
||||
}
|
||||
if (adjustToTerrain) {
|
||||
int l1 = (k + l + i1 + j1) / 4;
|
||||
for (int i2 = 0; i2 < model.vertexCount; i2++) {
|
||||
int j2 = model.vertexX[i2];
|
||||
int k2 = model.vertexZ[i2];
|
||||
int l2 = k + (((l - k) * (j2 + 64)) / 128);
|
||||
int i3 = j1 + (((i1 - j1) * (j2 + 64)) / 128);
|
||||
int j3 = l2 + (((i3 - l2) * (k2 + 64)) / 128);
|
||||
model.vertexY[i2] += j3 - l1;
|
||||
}
|
||||
model.calculateBoundsY();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
public Model getModel(int kind, int rotation, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int seqFrame) {
|
||||
Model model = getModel(kind, seqFrame, rotation);
|
||||
|
||||
public boolean method579() {
|
||||
if (modelIds == null) {
|
||||
return true;
|
||||
}
|
||||
boolean flag1 = true;
|
||||
for (int j : modelIds) {
|
||||
flag1 &= Model.validate(j & 0xffff);
|
||||
}
|
||||
return flag1;
|
||||
}
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public LocType method580() {
|
||||
int i = -1;
|
||||
if (varbit != -1) {
|
||||
VarbitType varbit = VarbitType.instances[this.varbit];
|
||||
int j = varbit.varp;
|
||||
int k = varbit.lsb;
|
||||
int l = varbit.msb;
|
||||
int i1 = Game.BITMASK[l - k];
|
||||
i = (game.variables[j] >> k) & i1;
|
||||
} else if (varp != -1) {
|
||||
i = game.variables[varp];
|
||||
}
|
||||
if ((i < 0) || (i >= overrideIds.length) || (overrideIds[i] == -1)) {
|
||||
return null;
|
||||
} else {
|
||||
return get(overrideIds[i]);
|
||||
}
|
||||
}
|
||||
if (adjustToTerrain || dynamic) {
|
||||
model = new Model(adjustToTerrain, dynamic, model);
|
||||
}
|
||||
|
||||
public Model method581(int type, int seqFrame, int rotation) {
|
||||
Model model = null;
|
||||
long bitset;
|
||||
if (modelTypes == null) {
|
||||
if (type != 10) {
|
||||
return null;
|
||||
}
|
||||
bitset = ((long) index << 6) + rotation + ((long) (seqFrame + 1) << 32);
|
||||
Model model_1 = aCache_780.get(bitset);
|
||||
if (model_1 != null) {
|
||||
return model_1;
|
||||
}
|
||||
if (modelIds == null) {
|
||||
return null;
|
||||
}
|
||||
boolean flip = invert ^ (rotation > 3);
|
||||
int modelCount = modelIds.length;
|
||||
if (adjustToTerrain) {
|
||||
int groundY = (heightmapSW + heightmapSE + heightmapNE + heightmapNW) / 4;
|
||||
for (int i = 0; i < model.vertexCount; i++) {
|
||||
int x = model.vertexX[i];
|
||||
int z = model.vertexZ[i];
|
||||
int heightS = heightmapSW + (((heightmapSE - heightmapSW) * (x + 64)) / 128);
|
||||
int heightN = heightmapNW + (((heightmapNE - heightmapNW) * (x + 64)) / 128);
|
||||
int y = heightS + (((heightN - heightS) * (z + 64)) / 128);
|
||||
model.vertexY[i] += y - groundY;
|
||||
}
|
||||
model.calculateBoundsY();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
for (int i = 0; i < modelCount; i++) {
|
||||
int modelId = modelIds[i];
|
||||
public boolean method579() {
|
||||
if (modelIDs == null) {
|
||||
return true;
|
||||
}
|
||||
boolean flag1 = true;
|
||||
for (int j : modelIDs) {
|
||||
flag1 &= Model.validate(j & 0xffff);
|
||||
}
|
||||
return flag1;
|
||||
}
|
||||
|
||||
if (flip) {
|
||||
modelId += 0x10000;
|
||||
}
|
||||
public LocType getOverrideType() {
|
||||
int value = -1;
|
||||
|
||||
model = modelCache.get(modelId);
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelId & 0xffff);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (flip) {
|
||||
model.rotateY180();
|
||||
}
|
||||
modelCache.put((long) modelId, model);
|
||||
}
|
||||
if (varbit != -1) {
|
||||
VarbitType varbit = VarbitType.instances[this.varbit];
|
||||
int varp = varbit.varp;
|
||||
int low = varbit.lsb;
|
||||
int high = varbit.msb;
|
||||
int mask = Game.BITMASK[high - low];
|
||||
value = (game.variables[varp] >> low) & mask;
|
||||
} else if (varp != -1) {
|
||||
value = game.variables[varp];
|
||||
}
|
||||
|
||||
if (modelCount > 1) {
|
||||
TMP_MODELS[i] = model;
|
||||
}
|
||||
}
|
||||
if ((value < 0) || (value >= overrideTypeIDs.length) || (overrideTypeIDs[value] == -1)) {
|
||||
return null;
|
||||
} else {
|
||||
return get(overrideTypeIDs[value]);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelCount > 1) {
|
||||
model = new Model(modelCount, TMP_MODELS);
|
||||
}
|
||||
} else {
|
||||
int typeId = -1;
|
||||
for (int i = 0; i < modelTypes.length; i++) {
|
||||
if (modelTypes[i] != type) {
|
||||
continue;
|
||||
}
|
||||
typeId = i;
|
||||
break;
|
||||
}
|
||||
public Model getModel(int kind, int frame, int rotation) {
|
||||
Model model = null;
|
||||
long bitset;
|
||||
|
||||
if (typeId == -1) {
|
||||
return null;
|
||||
}
|
||||
if (modelKinds == null) {
|
||||
if (kind != 10) {
|
||||
return null;
|
||||
}
|
||||
|
||||
bitset = ((long) index << 6) + ((long) typeId << 3) + rotation + ((long) (seqFrame + 1) << 32);
|
||||
bitset = ((long) index << 6) + rotation + ((long) (frame + 1) << 32);
|
||||
Model cached = dynamicCache.get(bitset);
|
||||
|
||||
Model class30_sub2_sub4_sub6_2 = aCache_780.get(bitset);
|
||||
if (class30_sub2_sub4_sub6_2 != null) {
|
||||
return class30_sub2_sub4_sub6_2;
|
||||
}
|
||||
int j2 = modelIds[typeId];
|
||||
boolean flag3 = invert ^ (rotation > 3);
|
||||
if (flag3) {
|
||||
j2 += 0x10000;
|
||||
}
|
||||
model = modelCache.get(j2);
|
||||
if (model == null) {
|
||||
model = Model.tryGet(j2 & 0xffff);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (flag3) {
|
||||
model.rotateY180();
|
||||
}
|
||||
modelCache.put((long) j2, model);
|
||||
}
|
||||
}
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
boolean scaled = (scaleX != 128) || (scaleZ != 128) || (scaleY != 128);
|
||||
boolean translated = (translateX != 0) || (translateY != 0) || (translateZ != 0);
|
||||
if (modelIDs == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Model model_3 = new Model(srcColor == null, SeqFrame.isNull(seqFrame), (rotation == 0) && (seqFrame == -1) && !scaled && !translated, model);
|
||||
boolean flip = invert ^ (rotation > 3);
|
||||
int modelCount = modelIDs.length;
|
||||
|
||||
if (seqFrame != -1) {
|
||||
model_3.createLabelReferences();
|
||||
model_3.applySequenceFrame(seqFrame);
|
||||
model_3.labelFaces = null;
|
||||
model_3.labelVertices = null;
|
||||
}
|
||||
for (int i = 0; i < modelCount; i++) {
|
||||
int modelID = modelIDs[i];
|
||||
|
||||
while (rotation-- > 0) {
|
||||
model_3.rotateY90();
|
||||
}
|
||||
if (srcColor != null) {
|
||||
for (int k2 = 0; k2 < srcColor.length; k2++) {
|
||||
model_3.recolor(srcColor[k2], dstColor[k2]);
|
||||
}
|
||||
}
|
||||
if (scaled) {
|
||||
model_3.scale(scaleX, scaleY, scaleZ);
|
||||
}
|
||||
if (translated) {
|
||||
model_3.translate(translateX, translateY, translateZ);
|
||||
}
|
||||
model_3.calculateNormals(64 + lightAmbient, 768 + (lightAttenuation * 5), -50, -10, -50, !dynamic);
|
||||
if (supportsObj == 1) {
|
||||
model_3.objRaise = model_3.minY;
|
||||
}
|
||||
aCache_780.put(bitset, model_3);
|
||||
return model_3;
|
||||
}
|
||||
if (flip) {
|
||||
modelID += 0x10000;
|
||||
}
|
||||
|
||||
public void method582(Buffer buffer) {
|
||||
int i = -1;
|
||||
label0:
|
||||
do {
|
||||
int j;
|
||||
do {
|
||||
j = buffer.get1U();
|
||||
if (j == 0) {
|
||||
break label0;
|
||||
}
|
||||
if (j == 1) {
|
||||
int k = buffer.get1U();
|
||||
if (k > 0) {
|
||||
if ((modelIds == null) || lowmem) {
|
||||
modelTypes = new int[k];
|
||||
modelIds = new int[k];
|
||||
for (int k1 = 0; k1 < k; k1++) {
|
||||
modelIds[k1] = buffer.get2U();
|
||||
modelTypes[k1] = buffer.get1U();
|
||||
}
|
||||
} else {
|
||||
buffer.position += k * 3;
|
||||
}
|
||||
}
|
||||
} else if (j == 2) {
|
||||
name = buffer.getString();
|
||||
} else if (j == 3) {
|
||||
description = buffer.getString();
|
||||
} else if (j == 5) {
|
||||
int l = buffer.get1U();
|
||||
if (l > 0) {
|
||||
if ((modelIds == null) || lowmem) {
|
||||
modelTypes = null;
|
||||
modelIds = new int[l];
|
||||
for (int l1 = 0; l1 < l; l1++) {
|
||||
modelIds[l1] = buffer.get2U();
|
||||
}
|
||||
} else {
|
||||
buffer.position += l * 2;
|
||||
}
|
||||
}
|
||||
} else if (j == 14) {
|
||||
width = buffer.get1U();
|
||||
} else if (j == 15) {
|
||||
length = buffer.get1U();
|
||||
} else if (j == 17) {
|
||||
solid = false;
|
||||
} else if (j == 18) {
|
||||
blocksProjectiles = false;
|
||||
} else if (j == 19) {
|
||||
i = buffer.get1U();
|
||||
if (i == 1) {
|
||||
interactable = true;
|
||||
}
|
||||
} else if (j == 21) {
|
||||
adjustToTerrain = true;
|
||||
} else if (j == 22) {
|
||||
dynamic = true;
|
||||
} else if (j == 23) {
|
||||
occludes = true;
|
||||
} else if (j == 24) {
|
||||
seqId = buffer.get2U();
|
||||
if (seqId == 65535) {
|
||||
seqId = -1;
|
||||
}
|
||||
} else if (j == 28) {
|
||||
decorationPadding = buffer.get1U();
|
||||
} else if (j == 29) {
|
||||
lightAmbient = buffer.get1();
|
||||
} else if (j == 39) {
|
||||
lightAttenuation = buffer.get1();
|
||||
} else if ((j >= 30) && (j < 39)) {
|
||||
if (actions == null) {
|
||||
actions = new String[5];
|
||||
}
|
||||
actions[j - 30] = buffer.getString();
|
||||
if (actions[j - 30].equalsIgnoreCase("hidden")) {
|
||||
actions[j - 30] = null;
|
||||
}
|
||||
} else if (j == 40) {
|
||||
int i1 = buffer.get1U();
|
||||
srcColor = new int[i1];
|
||||
dstColor = new int[i1];
|
||||
for (int i2 = 0; i2 < i1; i2++) {
|
||||
srcColor[i2] = buffer.get2U();
|
||||
dstColor[i2] = buffer.get2U();
|
||||
}
|
||||
} else if (j == 60) {
|
||||
mapfunctionIcon = buffer.get2U();
|
||||
} else if (j == 62) {
|
||||
invert = true;
|
||||
} else if (j == 64) {
|
||||
castShadow = false;
|
||||
} else if (j == 65) {
|
||||
scaleX = buffer.get2U();
|
||||
} else if (j == 66) {
|
||||
scaleZ = buffer.get2U();
|
||||
} else if (j == 67) {
|
||||
scaleY = buffer.get2U();
|
||||
} else if (j == 68) {
|
||||
mapsceneIcon = buffer.get2U();
|
||||
} else if (j == 69) {
|
||||
interactionSideFlags = buffer.get1U();
|
||||
} else if (j == 70) {
|
||||
translateX = buffer.get2();
|
||||
} else if (j == 71) {
|
||||
translateY = buffer.get2();
|
||||
} else if (j == 72) {
|
||||
translateZ = buffer.get2();
|
||||
} else if (j == 73) {
|
||||
important = true;
|
||||
} else if (j == 74) {
|
||||
decorative = true;
|
||||
} else {
|
||||
if (j != 75) {
|
||||
continue;
|
||||
}
|
||||
supportsObj = buffer.get1U();
|
||||
}
|
||||
continue label0;
|
||||
} while (j != 77);
|
||||
varbit = buffer.get2U();
|
||||
if (varbit == 65535) {
|
||||
varbit = -1;
|
||||
}
|
||||
varp = buffer.get2U();
|
||||
if (varp == 65535) {
|
||||
varp = -1;
|
||||
}
|
||||
int j1 = buffer.get1U();
|
||||
overrideIds = new int[j1 + 1];
|
||||
for (int j2 = 0; j2 <= j1; j2++) {
|
||||
overrideIds[j2] = buffer.get2U();
|
||||
if (overrideIds[j2] == 65535) {
|
||||
overrideIds[j2] = -1;
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
if (i == -1) {
|
||||
interactable = (modelIds != null) && ((modelTypes == null) || (modelTypes[0] == 10));
|
||||
if (actions != null) {
|
||||
interactable = true;
|
||||
}
|
||||
}
|
||||
if (decorative) {
|
||||
solid = false;
|
||||
blocksProjectiles = false;
|
||||
}
|
||||
if (supportsObj == -1) {
|
||||
supportsObj = solid ? 1 : 0;
|
||||
}
|
||||
}
|
||||
model = staticCache.get(modelID);
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelID & 0xffff);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (flip) {
|
||||
model.rotateY180();
|
||||
}
|
||||
staticCache.put((long) modelID, model);
|
||||
}
|
||||
|
||||
if (modelCount > 1) {
|
||||
TMP_MODELS[i] = model;
|
||||
}
|
||||
}
|
||||
|
||||
if (modelCount > 1) {
|
||||
model = new Model(modelCount, TMP_MODELS);
|
||||
}
|
||||
} else {
|
||||
int kindIndex = -1;
|
||||
|
||||
for (int i = 0; i < modelKinds.length; i++) {
|
||||
if (modelKinds[i] != kind) {
|
||||
continue;
|
||||
}
|
||||
kindIndex = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (kindIndex == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
bitset = ((long) this.index << 6) + ((long) kindIndex << 3) + rotation + ((long) (frame + 1) << 32);
|
||||
|
||||
Model cached = dynamicCache.get(bitset);
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
int modelID = modelIDs[kindIndex];
|
||||
boolean flip = invert ^ (rotation > 3);
|
||||
|
||||
if (flip) {
|
||||
modelID += 0x10000;
|
||||
}
|
||||
|
||||
model = staticCache.get(modelID);
|
||||
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelID & 0xffff);
|
||||
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (flip) {
|
||||
model.rotateY180();
|
||||
}
|
||||
|
||||
staticCache.put((long) modelID, model);
|
||||
}
|
||||
}
|
||||
|
||||
boolean scaled = (scaleX != 128) || (scaleZ != 128) || (scaleY != 128);
|
||||
boolean translated = (translateX != 0) || (translateY != 0) || (translateZ != 0);
|
||||
|
||||
Model modified = new Model(srcColor == null, SeqFrame.isNull(frame), (rotation == 0) && (frame == -1) && !scaled && !translated, model);
|
||||
|
||||
if (frame != -1) {
|
||||
modified.createLabelReferences();
|
||||
modified.applySequenceFrame(frame);
|
||||
modified.labelFaces = null;
|
||||
modified.labelVertices = null;
|
||||
}
|
||||
|
||||
while (rotation-- > 0) {
|
||||
modified.rotateY90();
|
||||
}
|
||||
|
||||
if (srcColor != null) {
|
||||
for (int k2 = 0; k2 < srcColor.length; k2++) {
|
||||
modified.recolor(srcColor[k2], dstColor[k2]);
|
||||
}
|
||||
}
|
||||
|
||||
if (scaled) {
|
||||
modified.scale(scaleX, scaleY, scaleZ);
|
||||
}
|
||||
|
||||
if (translated) {
|
||||
modified.translate(translateX, translateY, translateZ);
|
||||
}
|
||||
|
||||
modified.calculateNormals(64 + lightAmbient, 768 + (lightAttenuation * 5), -50, -10, -50, !dynamic);
|
||||
|
||||
if (supportsObj == 1) {
|
||||
modified.objRaise = modified.minY;
|
||||
}
|
||||
|
||||
dynamicCache.put(bitset, modified);
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void method582(Buffer buffer) {
|
||||
int i = -1;
|
||||
label0:
|
||||
do {
|
||||
int j;
|
||||
do {
|
||||
j = buffer.get1U();
|
||||
if (j == 0) {
|
||||
break label0;
|
||||
}
|
||||
if (j == 1) {
|
||||
int k = buffer.get1U();
|
||||
if (k > 0) {
|
||||
if ((modelIDs == null) || lowmem) {
|
||||
modelKinds = new int[k];
|
||||
modelIDs = new int[k];
|
||||
for (int k1 = 0; k1 < k; k1++) {
|
||||
modelIDs[k1] = buffer.get2U();
|
||||
modelKinds[k1] = buffer.get1U();
|
||||
}
|
||||
} else {
|
||||
buffer.position += k * 3;
|
||||
}
|
||||
}
|
||||
} else if (j == 2) {
|
||||
name = buffer.getString();
|
||||
} else if (j == 3) {
|
||||
description = buffer.getString();
|
||||
} else if (j == 5) {
|
||||
int l = buffer.get1U();
|
||||
if (l > 0) {
|
||||
if ((modelIDs == null) || lowmem) {
|
||||
modelKinds = null;
|
||||
modelIDs = new int[l];
|
||||
for (int l1 = 0; l1 < l; l1++) {
|
||||
modelIDs[l1] = buffer.get2U();
|
||||
}
|
||||
} else {
|
||||
buffer.position += l * 2;
|
||||
}
|
||||
}
|
||||
} else if (j == 14) {
|
||||
width = buffer.get1U();
|
||||
} else if (j == 15) {
|
||||
length = buffer.get1U();
|
||||
} else if (j == 17) {
|
||||
solid = false;
|
||||
} else if (j == 18) {
|
||||
blocksProjectiles = false;
|
||||
} else if (j == 19) {
|
||||
i = buffer.get1U();
|
||||
if (i == 1) {
|
||||
interactable = true;
|
||||
}
|
||||
} else if (j == 21) {
|
||||
adjustToTerrain = true;
|
||||
} else if (j == 22) {
|
||||
dynamic = true;
|
||||
} else if (j == 23) {
|
||||
occludes = true;
|
||||
} else if (j == 24) {
|
||||
seqId = buffer.get2U();
|
||||
if (seqId == 65535) {
|
||||
seqId = -1;
|
||||
}
|
||||
} else if (j == 28) {
|
||||
decorationPadding = buffer.get1U();
|
||||
} else if (j == 29) {
|
||||
lightAmbient = buffer.get1();
|
||||
} else if (j == 39) {
|
||||
lightAttenuation = buffer.get1();
|
||||
} else if ((j >= 30) && (j < 39)) {
|
||||
if (actions == null) {
|
||||
actions = new String[5];
|
||||
}
|
||||
actions[j - 30] = buffer.getString();
|
||||
if (actions[j - 30].equalsIgnoreCase("hidden")) {
|
||||
actions[j - 30] = null;
|
||||
}
|
||||
} else if (j == 40) {
|
||||
int i1 = buffer.get1U();
|
||||
srcColor = new int[i1];
|
||||
dstColor = new int[i1];
|
||||
for (int i2 = 0; i2 < i1; i2++) {
|
||||
srcColor[i2] = buffer.get2U();
|
||||
dstColor[i2] = buffer.get2U();
|
||||
}
|
||||
} else if (j == 60) {
|
||||
mapfunctionIcon = buffer.get2U();
|
||||
} else if (j == 62) {
|
||||
invert = true;
|
||||
} else if (j == 64) {
|
||||
castShadow = false;
|
||||
} else if (j == 65) {
|
||||
scaleX = buffer.get2U();
|
||||
} else if (j == 66) {
|
||||
scaleZ = buffer.get2U();
|
||||
} else if (j == 67) {
|
||||
scaleY = buffer.get2U();
|
||||
} else if (j == 68) {
|
||||
mapsceneIcon = buffer.get2U();
|
||||
} else if (j == 69) {
|
||||
interactionSideFlags = buffer.get1U();
|
||||
} else if (j == 70) {
|
||||
translateX = buffer.get2();
|
||||
} else if (j == 71) {
|
||||
translateY = buffer.get2();
|
||||
} else if (j == 72) {
|
||||
translateZ = buffer.get2();
|
||||
} else if (j == 73) {
|
||||
important = true;
|
||||
} else if (j == 74) {
|
||||
decorative = true;
|
||||
} else {
|
||||
if (j != 75) {
|
||||
continue;
|
||||
}
|
||||
supportsObj = buffer.get1U();
|
||||
}
|
||||
continue label0;
|
||||
} while (j != 77);
|
||||
varbit = buffer.get2U();
|
||||
if (varbit == 65535) {
|
||||
varbit = -1;
|
||||
}
|
||||
varp = buffer.get2U();
|
||||
if (varp == 65535) {
|
||||
varp = -1;
|
||||
}
|
||||
int j1 = buffer.get1U();
|
||||
overrideTypeIDs = new int[j1 + 1];
|
||||
for (int j2 = 0; j2 <= j1; j2++) {
|
||||
overrideTypeIDs[j2] = buffer.get2U();
|
||||
if (overrideTypeIDs[j2] == 65535) {
|
||||
overrideTypeIDs[j2] = -1;
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
if (i == -1) {
|
||||
interactable = (modelIDs != null) && ((modelKinds == null) || (modelKinds[0] == 10));
|
||||
if (actions != null) {
|
||||
interactable = true;
|
||||
}
|
||||
}
|
||||
if (decorative) {
|
||||
solid = false;
|
||||
blocksProjectiles = false;
|
||||
}
|
||||
if (supportsObj == -1) {
|
||||
supportsObj = solid ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -892,7 +892,7 @@ public class Model extends Entity {
|
||||
* @param copyVertexY <code>true</code> to copy <code>model.vertexY</code>.
|
||||
* @param copyFaces <code>true</code> to copy all face data from <code>model</code>.
|
||||
* @param model the model to copy.
|
||||
* @see LocType#method578(int, int, int, int, int, int, int)
|
||||
* @see LocType#getModel(int, int, int, int, int, int, int)
|
||||
*/
|
||||
public Model(boolean copyVertexY, boolean copyFaces, Model model) {
|
||||
counter++;
|
||||
|
||||
+91
-86
@@ -329,56 +329,56 @@ public class Scene {
|
||||
planeTiles[plane][stx][stz].objStack = objStack;
|
||||
}
|
||||
|
||||
public void addWall(int type0, Entity wall0, int type1, Entity wall1, int plane, int stx, int stz, int y, int bitset, byte info) {
|
||||
if ((wall0 == null) && (wall1 == null)) {
|
||||
public void setWall(int occludeA, Entity entityA, int occludeB, Entity entityB, int plane, int localX, int localZ, int y, int bitset, byte info) {
|
||||
if ((entityA == null) && (entityB == null)) {
|
||||
return;
|
||||
}
|
||||
SceneWall wall = new SceneWall();
|
||||
wall.bitset = bitset;
|
||||
wall.info = info;
|
||||
wall.x = (stx * 128) + 64;
|
||||
wall.z = (stz * 128) + 64;
|
||||
wall.x = (localX * 128) + 64;
|
||||
wall.z = (localZ * 128) + 64;
|
||||
wall.y = y;
|
||||
wall.entity0 = wall0;
|
||||
wall.entity1 = wall1;
|
||||
wall.type0 = type0;
|
||||
wall.type1 = type1;
|
||||
wall.entityA = entityA;
|
||||
wall.entityB = entityB;
|
||||
wall.occludeA = occludeA;
|
||||
wall.occludeB = occludeB;
|
||||
for (int p = plane; p >= 0; p--) {
|
||||
if (planeTiles[p][stx][stz] == null) {
|
||||
planeTiles[p][stx][stz] = new SceneTile(p, stx, stz);
|
||||
if (planeTiles[p][localX][localZ] == null) {
|
||||
planeTiles[p][localX][localZ] = new SceneTile(p, localX, localZ);
|
||||
}
|
||||
}
|
||||
planeTiles[plane][stx][stz].wall = wall;
|
||||
planeTiles[plane][localX][localZ].wall = wall;
|
||||
}
|
||||
|
||||
public void addWallDecoration(int type, Entity entity, int plane, int stx, int stz, int y, int yaw, int offsetX, int offsetZ, int bitset, byte info) {
|
||||
public void setWallDecoration(int occlude, Entity entity, int plane, int localX, int localZ, int y, int yaw, int offsetX, int offsetZ, int bitset, byte info) {
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
SceneWallDecoration decor = new SceneWallDecoration();
|
||||
decor.bitset = bitset;
|
||||
decor.info = info;
|
||||
decor.x = (stx * 128) + 64 + offsetX;
|
||||
decor.z = (stz * 128) + 64 + offsetZ;
|
||||
decor.y = y;
|
||||
decor.entity = entity;
|
||||
decor.type = type;
|
||||
decor.yaw = yaw;
|
||||
SceneWallDecoration deco = new SceneWallDecoration();
|
||||
deco.bitset = bitset;
|
||||
deco.info = info;
|
||||
deco.x = (localX * 128) + 64 + offsetX;
|
||||
deco.z = (localZ * 128) + 64 + offsetZ;
|
||||
deco.y = y;
|
||||
deco.entity = entity;
|
||||
deco.occlude = occlude;
|
||||
deco.yaw = yaw;
|
||||
for (int p = plane; p >= 0; p--) {
|
||||
if (planeTiles[p][stx][stz] == null) {
|
||||
planeTiles[p][stx][stz] = new SceneTile(p, stx, stz);
|
||||
if (planeTiles[p][localX][localZ] == null) {
|
||||
planeTiles[p][localX][localZ] = new SceneTile(p, localX, localZ);
|
||||
}
|
||||
}
|
||||
planeTiles[plane][stx][stz].wallDecoration = decor;
|
||||
planeTiles[plane][localX][localZ].wallDecoration = deco;
|
||||
}
|
||||
|
||||
public boolean add(Entity entity, int plane, int stx, int stz, int y, int width, int length, int yaw, int bitset, byte info) {
|
||||
public boolean add(Entity entity, int plane, int localX, int localZ, int y, int width, int length, int yaw, int bitset, byte info) {
|
||||
if (entity == null) {
|
||||
return true;
|
||||
} else {
|
||||
int x = (stx * 128) + (64 * width);
|
||||
int z = (stz * 128) + (64 * length);
|
||||
return add(entity, plane, stx, stz, width, length, x, z, y, yaw, bitset, info, false);
|
||||
int x = (localX * 128) + (64 * width);
|
||||
int z = (localZ * 128) + (64 * length);
|
||||
return add(entity, plane, localX, localZ, width, length, x, z, y, yaw, bitset, info, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,8 +628,8 @@ public class Scene {
|
||||
}
|
||||
}
|
||||
|
||||
public int getWallBitset(int i, int j, int k) {
|
||||
SceneTile tile = planeTiles[i][j][k];
|
||||
public int getWallBitset(int plane, int x, int z) {
|
||||
SceneTile tile = planeTiles[plane][x][z];
|
||||
if ((tile != null) && (tile.wall != null)) {
|
||||
return tile.wall.bitset;
|
||||
} else {
|
||||
@@ -671,21 +671,26 @@ public class Scene {
|
||||
|
||||
public int getInfo(int plane, int x, int z, int bitset) {
|
||||
SceneTile tile = planeTiles[plane][x][z];
|
||||
|
||||
if (tile == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((tile.wall != null) && (tile.wall.bitset == bitset)) {
|
||||
return tile.wall.info & 0xff;
|
||||
}
|
||||
|
||||
if ((tile.wallDecoration != null) && (tile.wallDecoration.bitset == bitset)) {
|
||||
return tile.wallDecoration.info & 0xff;
|
||||
}
|
||||
|
||||
if ((tile.groundDecoration != null) && (tile.groundDecoration.bitset == bitset)) {
|
||||
return tile.groundDecoration.info & 0xff;
|
||||
}
|
||||
for (int i1 = 0; i1 < tile.locCount; i1++) {
|
||||
if (tile.locs[i1].bitset == bitset) {
|
||||
return tile.locs[i1].info & 0xff;
|
||||
|
||||
for (int i = 0; i < tile.locCount; i++) {
|
||||
if (tile.locs[i].bitset == bitset) {
|
||||
return tile.locs[i].info & 0xff;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@@ -700,14 +705,14 @@ public class Scene {
|
||||
SceneTile tile = planeTiles[l1][i2][j2];
|
||||
if (tile != null) {
|
||||
SceneWall wall = tile.wall;
|
||||
if ((wall != null) && (wall.entity0 != null) && (wall.entity0.vertexNormal != null)) {
|
||||
method307(l1, 1, 1, i2, j2, (Model) wall.entity0);
|
||||
if ((wall.entity1 != null) && (wall.entity1.vertexNormal != null)) {
|
||||
method307(l1, 1, 1, i2, j2, (Model) wall.entity1);
|
||||
method308((Model) wall.entity0, (Model) wall.entity1, 0, 0, 0, false);
|
||||
((Model) wall.entity1).applyLighting(j, k1, k, i, i1);
|
||||
if ((wall != null) && (wall.entityA != null) && (wall.entityA.vertexNormal != null)) {
|
||||
method307(l1, 1, 1, i2, j2, (Model) wall.entityA);
|
||||
if ((wall.entityB != null) && (wall.entityB.vertexNormal != null)) {
|
||||
method307(l1, 1, 1, i2, j2, (Model) wall.entityB);
|
||||
method308((Model) wall.entityA, (Model) wall.entityB, 0, 0, 0, false);
|
||||
((Model) wall.entityB).applyLighting(j, k1, k, i, i1);
|
||||
}
|
||||
((Model) wall.entity0).applyLighting(j, k1, k, i, i1);
|
||||
((Model) wall.entityA).applyLighting(j, k1, k, i, i1);
|
||||
}
|
||||
for (int k2 = 0; k2 < tile.locCount; k2++) {
|
||||
SceneLoc loc = tile.locs[k2];
|
||||
@@ -770,11 +775,11 @@ public class Scene {
|
||||
if (tile != null) {
|
||||
int i3 = ((planeHeightmaps[j2][k2][l2] + planeHeightmaps[j2][k2 + 1][l2] + planeHeightmaps[j2][k2][l2 + 1] + planeHeightmaps[j2][k2 + 1][l2 + 1]) / 4) - ((planeHeightmaps[i][l][i1] + planeHeightmaps[i][l + 1][i1] + planeHeightmaps[i][l][i1 + 1] + planeHeightmaps[i][l + 1][i1 + 1]) / 4);
|
||||
SceneWall wall = tile.wall;
|
||||
if ((wall != null) && (wall.entity0 != null) && (wall.entity0.vertexNormal != null)) {
|
||||
method308(model, (Model) wall.entity0, ((k2 - l) * 128) + ((1 - j) * 64), i3, ((l2 - i1) * 128) + ((1 - k) * 64), flag);
|
||||
if ((wall != null) && (wall.entityA != null) && (wall.entityA.vertexNormal != null)) {
|
||||
method308(model, (Model) wall.entityA, ((k2 - l) * 128) + ((1 - j) * 64), i3, ((l2 - i1) * 128) + ((1 - k) * 64), flag);
|
||||
}
|
||||
if ((wall != null) && (wall.entity1 != null) && (wall.entity1.vertexNormal != null)) {
|
||||
method308(model, (Model) wall.entity1, ((k2 - l) * 128) + ((1 - j) * 64), i3, ((l2 - i1) * 128) + ((1 - k) * 64), flag);
|
||||
if ((wall != null) && (wall.entityB != null) && (wall.entityB.vertexNormal != null)) {
|
||||
method308(model, (Model) wall.entityB, ((k2 - l) * 128) + ((1 - j) * 64), i3, ((l2 - i1) * 128) + ((1 - k) * 64), flag);
|
||||
}
|
||||
for (int j3 = 0; j3 < tile.locCount; j3++) {
|
||||
SceneLoc loc = tile.locs[j3];
|
||||
@@ -1154,7 +1159,7 @@ public class Scene {
|
||||
}
|
||||
SceneWall wall = tile_7.wall;
|
||||
if (wall != null) {
|
||||
wall.entity0.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
wall.entityA.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
for (int i2 = 0; i2 < tile_7.locCount; i2++) {
|
||||
SceneLoc loc = tile_7.locs[i2];
|
||||
@@ -1192,16 +1197,16 @@ public class Scene {
|
||||
tile_1.anInt1328 = anIntArray480[j1];
|
||||
}
|
||||
if (wall != null) {
|
||||
if ((wall.type0 & anIntArray479[j1]) != 0) {
|
||||
if (wall.type0 == 16) {
|
||||
if ((wall.occludeA & anIntArray479[j1]) != 0) {
|
||||
if (wall.occludeA == 16) {
|
||||
tile_1.anInt1325 = 3;
|
||||
tile_1.anInt1326 = anIntArray481[j1];
|
||||
tile_1.anInt1327 = 3 - tile_1.anInt1326;
|
||||
} else if (wall.type0 == 32) {
|
||||
} else if (wall.occludeA == 32) {
|
||||
tile_1.anInt1325 = 6;
|
||||
tile_1.anInt1326 = anIntArray482[j1];
|
||||
tile_1.anInt1327 = 6 - tile_1.anInt1326;
|
||||
} else if (wall.type0 == 64) {
|
||||
} else if (wall.occludeA == 64) {
|
||||
tile_1.anInt1325 = 12;
|
||||
tile_1.anInt1326 = anIntArray483[j1];
|
||||
tile_1.anInt1327 = 12 - tile_1.anInt1326;
|
||||
@@ -1213,17 +1218,17 @@ public class Scene {
|
||||
} else {
|
||||
tile_1.anInt1325 = 0;
|
||||
}
|
||||
if (((wall.type0 & j2) != 0) && !wallOccluded(l, i, j, wall.type0)) {
|
||||
wall.entity0.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
if (((wall.occludeA & j2) != 0) && !wallOccluded(l, i, j, wall.occludeA)) {
|
||||
wall.entityA.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
if (((wall.type1 & j2) != 0) && !wallOccluded(l, i, j, wall.type1)) {
|
||||
wall.entity1.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
if (((wall.occludeB & j2) != 0) && !wallOccluded(l, i, j, wall.occludeB)) {
|
||||
wall.entityB.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
}
|
||||
if ((decor != null) && !occluded(l, i, j, decor.entity.minY)) {
|
||||
if ((decor.type & j2) != 0) {
|
||||
if ((decor.occlude & j2) != 0) {
|
||||
decor.entity.draw(decor.yaw, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, decor.x - eyeX, decor.y - eyeY, decor.z - eyeZ, decor.bitset);
|
||||
} else if ((decor.type & 0x300) != 0) {
|
||||
} else if ((decor.occlude & 0x300) != 0) {
|
||||
int j4 = decor.x - eyeX;
|
||||
int l5 = decor.y - eyeY;
|
||||
int k6 = decor.z - eyeZ;
|
||||
@@ -1240,12 +1245,12 @@ public class Scene {
|
||||
} else {
|
||||
k10 = k6;
|
||||
}
|
||||
if (((decor.type & 0x100) != 0) && (k10 < k9)) {
|
||||
if (((decor.occlude & 0x100) != 0) && (k10 < k9)) {
|
||||
int i11 = j4 + anIntArray463[i8];
|
||||
int k11 = k6 + anIntArray464[i8];
|
||||
decor.entity.draw((i8 * 512) + 256, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, i11, l5, k11, decor.bitset);
|
||||
}
|
||||
if (((decor.type & 0x200) != 0) && (k10 > k9)) {
|
||||
if (((decor.occlude & 0x200) != 0) && (k10 > k9)) {
|
||||
int j11 = j4 + anIntArray465[i8];
|
||||
int l11 = k6 + anIntArray466[i8];
|
||||
decor.entity.draw(((i8 * 512) + 1280) & 0x7ff, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, j11, l5, l11, decor.bitset);
|
||||
@@ -1309,8 +1314,8 @@ public class Scene {
|
||||
}
|
||||
if (flag2) {
|
||||
SceneWall wall_1 = tile_1.wall;
|
||||
if (!wallOccluded(l, i, j, wall_1.type0)) {
|
||||
wall_1.entity0.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall_1.x - eyeX, wall_1.y - eyeY, wall_1.z - eyeZ, wall_1.bitset);
|
||||
if (!wallOccluded(l, i, j, wall_1.occludeA)) {
|
||||
wall_1.entityA.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall_1.x - eyeX, wall_1.y - eyeY, wall_1.z - eyeZ, wall_1.bitset);
|
||||
}
|
||||
tile_1.anInt1325 = 0;
|
||||
}
|
||||
@@ -1474,46 +1479,46 @@ public class Scene {
|
||||
}
|
||||
}
|
||||
if (tile_1.anInt1328 != 0) {
|
||||
SceneWallDecoration wallDecoration = tile_1.wallDecoration;
|
||||
if ((wallDecoration != null) && !occluded(l, i, j, wallDecoration.entity.minY)) {
|
||||
if ((wallDecoration.type & tile_1.anInt1328) != 0) {
|
||||
wallDecoration.entity.draw(wallDecoration.yaw, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wallDecoration.x - eyeX, wallDecoration.y - eyeY, wallDecoration.z - eyeZ, wallDecoration.bitset);
|
||||
} else if ((wallDecoration.type & 0x300) != 0) {
|
||||
int l2 = wallDecoration.x - eyeX;
|
||||
int j3 = wallDecoration.y - eyeY;
|
||||
int i4 = wallDecoration.z - eyeZ;
|
||||
int k5 = wallDecoration.yaw;
|
||||
SceneWallDecoration deco = tile_1.wallDecoration;
|
||||
if ((deco != null) && !occluded(l, i, j, deco.entity.minY)) {
|
||||
if ((deco.occlude & tile_1.anInt1328) != 0) {
|
||||
deco.entity.draw(deco.yaw, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, deco.x - eyeX, deco.y - eyeY, deco.z - eyeZ, deco.bitset);
|
||||
} else if ((deco.occlude & 0x300) != 0) {
|
||||
int dx = deco.x - eyeX;
|
||||
int dy = deco.y - eyeY;
|
||||
int dz = deco.z - eyeZ;
|
||||
int rotation = deco.yaw;
|
||||
int j6;
|
||||
if ((k5 == 1) || (k5 == 2)) {
|
||||
j6 = -l2;
|
||||
if ((rotation == 1) || (rotation == 2)) {
|
||||
j6 = -dx;
|
||||
} else {
|
||||
j6 = l2;
|
||||
j6 = dx;
|
||||
}
|
||||
int l7;
|
||||
if ((k5 == 2) || (k5 == 3)) {
|
||||
l7 = -i4;
|
||||
if ((rotation == 2) || (rotation == 3)) {
|
||||
l7 = -dz;
|
||||
} else {
|
||||
l7 = i4;
|
||||
l7 = dz;
|
||||
}
|
||||
if (((wallDecoration.type & 0x100) != 0) && (l7 >= j6)) {
|
||||
int i9 = l2 + anIntArray463[k5];
|
||||
int i10 = i4 + anIntArray464[k5];
|
||||
wallDecoration.entity.draw((k5 * 512) + 256, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, i9, j3, i10, wallDecoration.bitset);
|
||||
if (((deco.occlude & 0x100) != 0) && (l7 >= j6)) {
|
||||
int i9 = dx + anIntArray463[rotation];
|
||||
int i10 = dz + anIntArray464[rotation];
|
||||
deco.entity.draw((rotation * 512) + 256, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, i9, dy, i10, deco.bitset);
|
||||
}
|
||||
if (((wallDecoration.type & 0x200) != 0) && (l7 <= j6)) {
|
||||
int j9 = l2 + anIntArray465[k5];
|
||||
int j10 = i4 + anIntArray466[k5];
|
||||
wallDecoration.entity.draw(((k5 * 512) + 1280) & 0x7ff, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, j9, j3, j10, wallDecoration.bitset);
|
||||
if (((deco.occlude & 0x200) != 0) && (l7 <= j6)) {
|
||||
int j9 = dx + anIntArray465[rotation];
|
||||
int j10 = dz + anIntArray466[rotation];
|
||||
deco.entity.draw(((rotation * 512) + 1280) & 0x7ff, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, j9, dy, j10, deco.bitset);
|
||||
}
|
||||
}
|
||||
}
|
||||
SceneWall wall_2 = tile_1.wall;
|
||||
if (wall_2 != null) {
|
||||
if (((wall_2.type1 & tile_1.anInt1328) != 0) && !wallOccluded(l, i, j, wall_2.type1)) {
|
||||
wall_2.entity1.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall_2.x - eyeX, wall_2.y - eyeY, wall_2.z - eyeZ, wall_2.bitset);
|
||||
if (((wall_2.occludeB & tile_1.anInt1328) != 0) && !wallOccluded(l, i, j, wall_2.occludeB)) {
|
||||
wall_2.entityB.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall_2.x - eyeX, wall_2.y - eyeY, wall_2.z - eyeZ, wall_2.bitset);
|
||||
}
|
||||
if (((wall_2.type0 & tile_1.anInt1328) != 0) && !wallOccluded(l, i, j, wall_2.type0)) {
|
||||
wall_2.entity0.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall_2.x - eyeX, wall_2.y - eyeY, wall_2.z - eyeZ, wall_2.bitset);
|
||||
if (((wall_2.occludeA & tile_1.anInt1328) != 0) && !wallOccluded(l, i, j, wall_2.occludeA)) {
|
||||
wall_2.entityA.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall_2.x - eyeX, wall_2.y - eyeY, wall_2.z - eyeZ, wall_2.bitset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1301
-1236
File diff suppressed because it is too large.
Load diff
@@ -29,157 +29,160 @@ public class SceneCollisionMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void method211(int i, int j, int k, int l, boolean flag) {
|
||||
if (l == 0) {
|
||||
if (j == 0) {
|
||||
method214(k, i, 128);
|
||||
method214(k - 1, i, 8);
|
||||
public void addWall(int i, int rotation, int k, int kind, boolean blocksProjectiles) {
|
||||
if (kind == 0) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 128);
|
||||
add(k - 1, i, 8);
|
||||
}
|
||||
if (j == 1) {
|
||||
method214(k, i, 2);
|
||||
method214(k, i + 1, 32);
|
||||
if (rotation == 1) {
|
||||
add(k, i, 2);
|
||||
add(k, i + 1, 32);
|
||||
}
|
||||
if (j == 2) {
|
||||
method214(k, i, 8);
|
||||
method214(k + 1, i, 128);
|
||||
if (rotation == 2) {
|
||||
add(k, i, 8);
|
||||
add(k + 1, i, 128);
|
||||
}
|
||||
if (j == 3) {
|
||||
method214(k, i, 32);
|
||||
method214(k, i - 1, 2);
|
||||
if (rotation == 3) {
|
||||
add(k, i, 32);
|
||||
add(k, i - 1, 2);
|
||||
}
|
||||
}
|
||||
if ((l == 1) || (l == 3)) {
|
||||
if (j == 0) {
|
||||
method214(k, i, 1);
|
||||
method214(k - 1, i + 1, 16);
|
||||
if ((kind == 1) || (kind == 3)) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 1);
|
||||
add(k - 1, i + 1, 16);
|
||||
}
|
||||
if (j == 1) {
|
||||
method214(k, i, 4);
|
||||
method214(k + 1, i + 1, 64);
|
||||
if (rotation == 1) {
|
||||
add(k, i, 4);
|
||||
add(k + 1, i + 1, 64);
|
||||
}
|
||||
if (j == 2) {
|
||||
method214(k, i, 16);
|
||||
method214(k + 1, i - 1, 1);
|
||||
if (rotation == 2) {
|
||||
add(k, i, 16);
|
||||
add(k + 1, i - 1, 1);
|
||||
}
|
||||
if (j == 3) {
|
||||
method214(k, i, 64);
|
||||
method214(k - 1, i - 1, 4);
|
||||
if (rotation == 3) {
|
||||
add(k, i, 64);
|
||||
add(k - 1, i - 1, 4);
|
||||
}
|
||||
}
|
||||
if (l == 2) {
|
||||
if (j == 0) {
|
||||
method214(k, i, 130);
|
||||
method214(k - 1, i, 8);
|
||||
method214(k, i + 1, 32);
|
||||
if (kind == 2) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 130);
|
||||
add(k - 1, i, 8);
|
||||
add(k, i + 1, 32);
|
||||
}
|
||||
if (j == 1) {
|
||||
method214(k, i, 10);
|
||||
method214(k, i + 1, 32);
|
||||
method214(k + 1, i, 128);
|
||||
if (rotation == 1) {
|
||||
add(k, i, 10);
|
||||
add(k, i + 1, 32);
|
||||
add(k + 1, i, 128);
|
||||
}
|
||||
if (j == 2) {
|
||||
method214(k, i, 40);
|
||||
method214(k + 1, i, 128);
|
||||
method214(k, i - 1, 2);
|
||||
if (rotation == 2) {
|
||||
add(k, i, 40);
|
||||
add(k + 1, i, 128);
|
||||
add(k, i - 1, 2);
|
||||
}
|
||||
if (j == 3) {
|
||||
method214(k, i, 160);
|
||||
method214(k, i - 1, 2);
|
||||
method214(k - 1, i, 8);
|
||||
if (rotation == 3) {
|
||||
add(k, i, 160);
|
||||
add(k, i - 1, 2);
|
||||
add(k - 1, i, 8);
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (l == 0) {
|
||||
if (j == 0) {
|
||||
method214(k, i, 0x10000);
|
||||
method214(k - 1, i, 4096);
|
||||
if (blocksProjectiles) {
|
||||
if (kind == 0) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 0x10000);
|
||||
add(k - 1, i, 4096);
|
||||
}
|
||||
if (j == 1) {
|
||||
method214(k, i, 1024);
|
||||
method214(k, i + 1, 16384);
|
||||
if (rotation == 1) {
|
||||
add(k, i, 1024);
|
||||
add(k, i + 1, 16384);
|
||||
}
|
||||
if (j == 2) {
|
||||
method214(k, i, 4096);
|
||||
method214(k + 1, i, 0x10000);
|
||||
if (rotation == 2) {
|
||||
add(k, i, 4096);
|
||||
add(k + 1, i, 0x10000);
|
||||
}
|
||||
if (j == 3) {
|
||||
method214(k, i, 16384);
|
||||
method214(k, i - 1, 1024);
|
||||
if (rotation == 3) {
|
||||
add(k, i, 16384);
|
||||
add(k, i - 1, 1024);
|
||||
}
|
||||
}
|
||||
if ((l == 1) || (l == 3)) {
|
||||
if (j == 0) {
|
||||
method214(k, i, 512);
|
||||
method214(k - 1, i + 1, 8192);
|
||||
if ((kind == 1) || (kind == 3)) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 512);
|
||||
add(k - 1, i + 1, 8192);
|
||||
}
|
||||
if (j == 1) {
|
||||
method214(k, i, 2048);
|
||||
method214(k + 1, i + 1, 32768);
|
||||
if (rotation == 1) {
|
||||
add(k, i, 2048);
|
||||
add(k + 1, i + 1, 32768);
|
||||
}
|
||||
if (j == 2) {
|
||||
method214(k, i, 8192);
|
||||
method214(k + 1, i - 1, 512);
|
||||
if (rotation == 2) {
|
||||
add(k, i, 8192);
|
||||
add(k + 1, i - 1, 512);
|
||||
}
|
||||
if (j == 3) {
|
||||
method214(k, i, 32768);
|
||||
method214(k - 1, i - 1, 2048);
|
||||
if (rotation == 3) {
|
||||
add(k, i, 32768);
|
||||
add(k - 1, i - 1, 2048);
|
||||
}
|
||||
}
|
||||
if (l == 2) {
|
||||
if (j == 0) {
|
||||
method214(k, i, 0x10400);
|
||||
method214(k - 1, i, 4096);
|
||||
method214(k, i + 1, 16384);
|
||||
if (kind == 2) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 0x10400);
|
||||
add(k - 1, i, 4096);
|
||||
add(k, i + 1, 16384);
|
||||
}
|
||||
if (j == 1) {
|
||||
method214(k, i, 5120);
|
||||
method214(k, i + 1, 16384);
|
||||
method214(k + 1, i, 0x10000);
|
||||
if (rotation == 1) {
|
||||
add(k, i, 5120);
|
||||
add(k, i + 1, 16384);
|
||||
add(k + 1, i, 0x10000);
|
||||
}
|
||||
if (j == 2) {
|
||||
method214(k, i, 20480);
|
||||
method214(k + 1, i, 0x10000);
|
||||
method214(k, i - 1, 1024);
|
||||
if (rotation == 2) {
|
||||
add(k, i, 20480);
|
||||
add(k + 1, i, 0x10000);
|
||||
add(k, i - 1, 1024);
|
||||
}
|
||||
if (j == 3) {
|
||||
method214(k, i, 0x14000);
|
||||
method214(k, i - 1, 1024);
|
||||
method214(k - 1, i, 4096);
|
||||
if (rotation == 3) {
|
||||
add(k, i, 0x14000);
|
||||
add(k, i - 1, 1024);
|
||||
add(k - 1, i, 4096);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void method212(boolean flag, int j, int k, int l, int i1, int j1) {
|
||||
int k1 = 256;
|
||||
if (flag) {
|
||||
k1 += 0x20000;
|
||||
public void add(boolean blocksProjectiles, int width, int length, int x, int z, int rotation) {
|
||||
int flags = 256;
|
||||
|
||||
if (blocksProjectiles) {
|
||||
flags += 0x20000;
|
||||
}
|
||||
if ((j1 == 1) || (j1 == 3)) {
|
||||
int l1 = j;
|
||||
j = k;
|
||||
k = l1;
|
||||
|
||||
if ((rotation == 1) || (rotation == 3)) {
|
||||
int tmp = width;
|
||||
width = length;
|
||||
length = tmp;
|
||||
}
|
||||
for (int i2 = l; i2 < (l + j); i2++) {
|
||||
if ((i2 >= 0) && (i2 < anInt292)) {
|
||||
for (int j2 = i1; j2 < (i1 + k); j2++) {
|
||||
if ((j2 >= 0) && (j2 < anInt293)) {
|
||||
method214(i2, j2, k1);
|
||||
|
||||
for (int tx = x; tx < (x + width); tx++) {
|
||||
if ((tx >= 0) && (tx < anInt292)) {
|
||||
for (int tz = z; tz < (z + length); tz++) {
|
||||
if ((tz >= 0) && (tz < anInt293)) {
|
||||
add(tx, tz, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void method213(int i, int k) {
|
||||
flags[k][i] |= 0x200000;
|
||||
public void addSolid(int z, int x) {
|
||||
flags[x][z] |= 0x200000;
|
||||
}
|
||||
|
||||
public void method214(int i, int j, int k) {
|
||||
flags[i][j] |= k;
|
||||
public void add(int x, int z, int k) {
|
||||
flags[x][z] |= k;
|
||||
}
|
||||
|
||||
public void method215(int i, int j, boolean flag, int k, int l) {
|
||||
public void remove(int i, int j, boolean flag, int k, int l) {
|
||||
if (j == 0) {
|
||||
if (i == 0) {
|
||||
method217(128, k, l);
|
||||
@@ -300,7 +303,7 @@ public class SceneCollisionMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void method216(int rotation, int width, int x0, int z0, int length, boolean flag) {
|
||||
public void remove(int rotation, int width, int x0, int z0, int length, boolean flag) {
|
||||
int flags = 256;
|
||||
if (flag) {
|
||||
flags += 0x20000;
|
||||
|
||||
@@ -8,13 +8,13 @@ public class SceneLocTemporary extends DoublyLinkedList.Node {
|
||||
public int anInt1292;
|
||||
public int anInt1293;
|
||||
public int anInt1294;
|
||||
public int anInt1295;
|
||||
public int anInt1296;
|
||||
public int sceneTileX;
|
||||
public int sceneTileZ;
|
||||
public int anInt1299;
|
||||
public int anInt1300;
|
||||
public int anInt1301;
|
||||
public int plane;
|
||||
public int classID;
|
||||
public int localX;
|
||||
public int localZ;
|
||||
public int savedLocID;
|
||||
public int savedRotation;
|
||||
public int savedKind;
|
||||
public int anInt1302;
|
||||
|
||||
public SceneLocTemporary() {
|
||||
|
||||
@@ -7,10 +7,10 @@ public class SceneWall {
|
||||
public int y;
|
||||
public int x;
|
||||
public int z;
|
||||
public int type0;
|
||||
public int type1;
|
||||
public Entity entity0;
|
||||
public Entity entity1;
|
||||
public int occludeA;
|
||||
public int occludeB;
|
||||
public Entity entityA;
|
||||
public Entity entityB;
|
||||
public int bitset;
|
||||
public byte info;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ public class SceneWallDecoration {
|
||||
public int y;
|
||||
public int x;
|
||||
public int z;
|
||||
public int type;
|
||||
public int occlude;
|
||||
public int yaw;
|
||||
public Entity entity;
|
||||
public int bitset;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SeqType {
|
||||
public int[] primaryFrames;
|
||||
public int[] secondaryFrames;
|
||||
public int[] frameDelays;
|
||||
public int anInt356 = -1;
|
||||
public int speed = -1;
|
||||
public int[] anIntArray357;
|
||||
public boolean aBoolean358 = false;
|
||||
public int anInt359 = 5;
|
||||
@@ -77,7 +77,7 @@ public class SeqType {
|
||||
frameDelays[j] = buffer.get2U();
|
||||
}
|
||||
} else if (op == 2) {
|
||||
anInt356 = buffer.get2U();
|
||||
speed = buffer.get2U();
|
||||
} else if (op == 3) {
|
||||
int k = buffer.get1U();
|
||||
anIntArray357 = new int[k + 1];
|
||||
|
||||
@@ -6,60 +6,60 @@
|
||||
*/
|
||||
public class SoundEnvelope {
|
||||
|
||||
public int length;
|
||||
public int[] shapeDelta;
|
||||
public int[] shapePeak;
|
||||
public int start;
|
||||
public int end;
|
||||
public int form;
|
||||
public int threshold;
|
||||
public int position;
|
||||
public int delta;
|
||||
public int amplitude;
|
||||
public int ticks;
|
||||
public int length;
|
||||
public int[] shapeDelta;
|
||||
public int[] shapePeak;
|
||||
public int start;
|
||||
public int end;
|
||||
public int form;
|
||||
public int threshold;
|
||||
public int position;
|
||||
public int delta;
|
||||
public int amplitude;
|
||||
public int ticks;
|
||||
|
||||
public SoundEnvelope() {
|
||||
}
|
||||
public SoundEnvelope() {
|
||||
}
|
||||
|
||||
public void read(Buffer buffer) {
|
||||
form = buffer.get1U();
|
||||
start = buffer.get4();
|
||||
end = buffer.get4();
|
||||
readShape(buffer);
|
||||
}
|
||||
public void read(Buffer buffer) {
|
||||
form = buffer.get1U();
|
||||
start = buffer.get4();
|
||||
end = buffer.get4();
|
||||
readShape(buffer);
|
||||
}
|
||||
|
||||
public void readShape(Buffer buffer) {
|
||||
length = buffer.get1U();
|
||||
shapeDelta = new int[length];
|
||||
shapePeak = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
shapeDelta[i] = buffer.get2U();
|
||||
shapePeak[i] = buffer.get2U();
|
||||
}
|
||||
}
|
||||
public void readShape(Buffer buffer) {
|
||||
length = buffer.get1U();
|
||||
shapeDelta = new int[length];
|
||||
shapePeak = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
shapeDelta[i] = buffer.get2U();
|
||||
shapePeak[i] = buffer.get2U();
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
threshold = 0;
|
||||
position = 0;
|
||||
delta = 0;
|
||||
amplitude = 0;
|
||||
ticks = 0;
|
||||
}
|
||||
public void reset() {
|
||||
threshold = 0;
|
||||
position = 0;
|
||||
delta = 0;
|
||||
amplitude = 0;
|
||||
ticks = 0;
|
||||
}
|
||||
|
||||
public int evaluate(int delta) {
|
||||
if (ticks >= threshold) {
|
||||
amplitude = shapePeak[position++] << 15;
|
||||
if (position >= length) {
|
||||
position = length - 1;
|
||||
}
|
||||
threshold = (int) (((double) shapeDelta[position] / 65536D) * (double) delta);
|
||||
if (threshold > ticks) {
|
||||
this.delta = ((shapePeak[position] << 15) - amplitude) / (threshold - ticks);
|
||||
}
|
||||
}
|
||||
amplitude += this.delta;
|
||||
ticks++;
|
||||
return (amplitude - this.delta) >> 15;
|
||||
}
|
||||
public int evaluate(int delta) {
|
||||
if (ticks >= threshold) {
|
||||
amplitude = shapePeak[position++] << 15;
|
||||
if (position >= length) {
|
||||
position = length - 1;
|
||||
}
|
||||
threshold = (int) (((double) shapeDelta[position] / 65536D) * (double) delta);
|
||||
if (threshold > ticks) {
|
||||
this.delta = ((shapePeak[position] << 15) - amplitude) / (threshold - ticks);
|
||||
}
|
||||
}
|
||||
amplitude += this.delta;
|
||||
ticks++;
|
||||
return (amplitude - this.delta) >> 15;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user