Refactored: CollisionMap
Renamed: LocType#prefetch Renamed: NPCType#options Renamed: NPCType#scaleZ Renamed: NPCType#scaleXY Renamed: NPCType#lightAttenuation Renamed: NPCType#lightAmbient Renamed: Random things in NPCType Renamed: OnDemand#prefetch Renamed: PlayerEntity#transmogrify Renamed: SceneBuilder#prefetchLocs Organized: SceneBuilder#addLoc Constants: SceneOccluder
This commit is contained in:
1 parent
6bb096a79f
commit
2c7e3211b3
15 files changed
+1379
-1332
No files matched your search
@@ -0,0 +1,469 @@
|
||||
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
public class CollisionMap {
|
||||
|
||||
public static final int FLAG_BLOCK_ENTITY_NW = 0x1;
|
||||
public static final int FLAG_BLOCK_ENTITY_N = 0x2;
|
||||
public static final int FLAG_BLOCK_ENTITY_NE = 0x4;
|
||||
public static final int FLAG_BLOCK_ENTITY_E = 0x8;
|
||||
public static final int FLAG_BLOCK_ENTITY_SE = 0x10;
|
||||
public static final int FLAG_BLOCK_ENTITY_S = 0x20;
|
||||
public static final int FLAG_BLOCK_ENTITY_SW = 0x40;
|
||||
public static final int FLAG_BLOCK_ENTITY_W = 0x80;
|
||||
public static final int FLAG_BLOCK_ENTITY = 0x100;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_NW = 0x200;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_N = 0x400;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_NE = 0x800;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_E = 0x1000;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_SE = 0x2000;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_S = 0x4000;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_SW = 0x8000;
|
||||
public static final int FLAG_BLOCK_PROJECTILE_W = 0x10000;
|
||||
public static final int FLAG_BLOCK_PROJECTILE = 0x20000;
|
||||
public static final int FLAG_UNINITIALIZED = 0x1000000;
|
||||
public static final int FLAG_CLOSED = 0xFFFFFF;
|
||||
|
||||
public final int sizeX;
|
||||
public final int sizeZ;
|
||||
public final int[][] flags;
|
||||
|
||||
public CollisionMap(int sizeX, int sizeZ) {
|
||||
this.sizeX = sizeX;
|
||||
this.sizeZ = sizeZ;
|
||||
flags = new int[this.sizeX][this.sizeZ];
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
for (int z = 0; z < sizeZ; z++) {
|
||||
if ((x == 0) || (z == 0) || (x == (sizeX - 1)) || (z == (sizeZ - 1))) {
|
||||
flags[x][z] = FLAG_CLOSED;
|
||||
} else {
|
||||
flags[x][z] = FLAG_UNINITIALIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addWall(int x, int z, int type, int rotation, boolean projectiles) {
|
||||
if (type == 0) {
|
||||
if (rotation == 0) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_W);
|
||||
add(x - 1, z, FLAG_BLOCK_ENTITY_E);
|
||||
} else if (rotation == 1) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_N);
|
||||
add(x, z + 1, FLAG_BLOCK_ENTITY_S);
|
||||
} else if (rotation == 2) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_E);
|
||||
add(x + 1, z, FLAG_BLOCK_ENTITY_W);
|
||||
} else if (rotation == 3) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_S);
|
||||
add(x, z - 1, FLAG_BLOCK_ENTITY_N);
|
||||
}
|
||||
} else if ((type == 1) || (type == 3)) {
|
||||
if (rotation == 0) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_NW);
|
||||
add(x - 1, z + 1, FLAG_BLOCK_ENTITY_SE);
|
||||
} else if (rotation == 1) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_NE);
|
||||
add(x + 1, z + 1, FLAG_BLOCK_ENTITY_SW);
|
||||
} else if (rotation == 2) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_SE);
|
||||
add(x + 1, z - 1, FLAG_BLOCK_ENTITY_NW);
|
||||
} else if (rotation == 3) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_SW);
|
||||
add(x - 1, z - 1, FLAG_BLOCK_ENTITY_NE);
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (rotation == 0) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_W|FLAG_BLOCK_ENTITY_N);
|
||||
add(x - 1, z, FLAG_BLOCK_ENTITY_E);
|
||||
add(x, z + 1, FLAG_BLOCK_ENTITY_S);
|
||||
} else if (rotation == 1) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_E|FLAG_BLOCK_ENTITY_N);
|
||||
add(x, z + 1, FLAG_BLOCK_ENTITY_S);
|
||||
add(x + 1, z, FLAG_BLOCK_ENTITY_W);
|
||||
} else if (rotation == 2) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_E|FLAG_BLOCK_ENTITY_S);
|
||||
add(x + 1, z, FLAG_BLOCK_ENTITY_W);
|
||||
add(x, z - 1, FLAG_BLOCK_ENTITY_N);
|
||||
} else if (rotation == 3) {
|
||||
add(x, z, FLAG_BLOCK_ENTITY_W|FLAG_BLOCK_ENTITY_S);
|
||||
add(x, z - 1, FLAG_BLOCK_ENTITY_N);
|
||||
add(x - 1, z, FLAG_BLOCK_ENTITY_E);
|
||||
}
|
||||
}
|
||||
|
||||
if (projectiles) {
|
||||
if (type == 0) {
|
||||
if (rotation == 0) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
add(x - 1, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
} else if (rotation == 1) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_N);
|
||||
add(x, z + 1, FLAG_BLOCK_PROJECTILE_S);
|
||||
} else if (rotation == 2) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
add(x + 1, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
} else if (rotation == 3) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_S);
|
||||
add(x, z - 1, FLAG_BLOCK_PROJECTILE_N);
|
||||
}
|
||||
} else if ((type == 1) || (type == 3)) {
|
||||
if (rotation == 0) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_NW);
|
||||
add(x - 1, z + 1, FLAG_BLOCK_PROJECTILE_SE);
|
||||
} else if (rotation == 1) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_NE);
|
||||
add(x + 1, z + 1, FLAG_BLOCK_PROJECTILE_SW);
|
||||
} else if (rotation == 2) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_SE);
|
||||
add(x + 1, z - 1, FLAG_BLOCK_PROJECTILE_NW);
|
||||
} else if (rotation == 3) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_SW);
|
||||
add(x - 1, z - 1, FLAG_BLOCK_PROJECTILE_NE);
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (rotation == 0) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_W|FLAG_BLOCK_PROJECTILE_N);
|
||||
add(x - 1, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
add(x, z + 1, FLAG_BLOCK_PROJECTILE_S);
|
||||
} else if (rotation == 1) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_E|FLAG_BLOCK_PROJECTILE_N);
|
||||
add(x, z + 1, FLAG_BLOCK_PROJECTILE_S);
|
||||
add(x + 1, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
} else if (rotation == 2) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_E|FLAG_BLOCK_PROJECTILE_S);
|
||||
add(x + 1, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
add(x, z - 1, FLAG_BLOCK_PROJECTILE_N);
|
||||
} else if (rotation == 3) {
|
||||
add(x, z, FLAG_BLOCK_PROJECTILE_W|FLAG_BLOCK_PROJECTILE_S);
|
||||
add(x, z - 1, FLAG_BLOCK_PROJECTILE_N);
|
||||
add(x - 1, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void add(boolean blocksProjectiles, int sizeX, int sizeZ, int x, int z, int rotation) {
|
||||
int flags = FLAG_BLOCK_ENTITY;
|
||||
|
||||
if (blocksProjectiles) {
|
||||
flags += FLAG_BLOCK_PROJECTILE;
|
||||
}
|
||||
|
||||
if ((rotation == 1) || (rotation == 3)) {
|
||||
int tmp = sizeX;
|
||||
sizeX = sizeZ;
|
||||
sizeZ = tmp;
|
||||
}
|
||||
|
||||
for (int tx = x; tx < (x + sizeX); tx++) {
|
||||
if ((tx >= 0) && (tx < this.sizeX)) {
|
||||
for (int tz = z; tz < (z + sizeZ); tz++) {
|
||||
if ((tz >= 0) && (tz < this.sizeZ)) {
|
||||
add(tx, tz, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addSolid(int x, int z) {
|
||||
flags[x][z] |= FLAG_UNINITIALIZED;
|
||||
}
|
||||
|
||||
public void add(int x, int z, int flags) {
|
||||
this.flags[x][z] |= flags;
|
||||
}
|
||||
|
||||
public void remove(int x, int z, int rotation, int type, boolean projectiles) {
|
||||
if (type == 0) {
|
||||
if (rotation == 0) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_W);
|
||||
remove(x - 1, z, FLAG_BLOCK_ENTITY_E);
|
||||
} else if (rotation == 1) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_N);
|
||||
remove(x, z + 1, FLAG_BLOCK_ENTITY_S);
|
||||
} else if (rotation == 2) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_E);
|
||||
remove(x + 1, z, FLAG_BLOCK_ENTITY_W);
|
||||
} else if (rotation == 3) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_S);
|
||||
remove(x, z - 1, FLAG_BLOCK_ENTITY_N);
|
||||
}
|
||||
} else if ((type == 1) || (type == 3)) {
|
||||
if (rotation == 0) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_NW);
|
||||
remove(x - 1, z + 1, FLAG_BLOCK_ENTITY_SE);
|
||||
} else if (rotation == 1) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_NE);
|
||||
remove(x + 1, z + 1, FLAG_BLOCK_ENTITY_SW);
|
||||
} else if (rotation == 2) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_SE);
|
||||
remove(x + 1, z - 1, FLAG_BLOCK_ENTITY_NW);
|
||||
} else if (rotation == 3) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_SW);
|
||||
remove(x - 1, z - 1, FLAG_BLOCK_ENTITY_NE);
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (rotation == 0) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_W|FLAG_BLOCK_ENTITY_N);
|
||||
remove(x - 1, z, FLAG_BLOCK_ENTITY_E);
|
||||
remove(x, z + 1, FLAG_BLOCK_ENTITY_S);
|
||||
} else if (rotation == 1) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_E|FLAG_BLOCK_ENTITY_N);
|
||||
remove(x, z + 1, FLAG_BLOCK_ENTITY_S);
|
||||
remove(x + 1, z, FLAG_BLOCK_ENTITY_W);
|
||||
} else if (rotation == 2) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_E|FLAG_BLOCK_ENTITY_S);
|
||||
remove(x + 1, z, FLAG_BLOCK_ENTITY_W);
|
||||
remove(x, z - 1, FLAG_BLOCK_ENTITY_N);
|
||||
} else if (rotation == 3) {
|
||||
remove(x, z, FLAG_BLOCK_ENTITY_W|FLAG_BLOCK_ENTITY_S);
|
||||
remove(x, z - 1, FLAG_BLOCK_ENTITY_N);
|
||||
remove(x - 1, z, FLAG_BLOCK_ENTITY_E);
|
||||
}
|
||||
}
|
||||
if (projectiles) {
|
||||
if (type == 0) {
|
||||
if (rotation == 0) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
remove(x - 1, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
} else if (rotation == 1) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_N);
|
||||
remove(x, z + 1, FLAG_BLOCK_PROJECTILE_S);
|
||||
} else if (rotation == 2) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
remove(x + 1, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
} else if (rotation == 3) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_S);
|
||||
remove(x, z - 1, FLAG_BLOCK_PROJECTILE_N);
|
||||
}
|
||||
} else if ((type == 1) || (type == 3)) {
|
||||
if (rotation == 0) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_NW);
|
||||
remove(x - 1, z + 1, FLAG_BLOCK_PROJECTILE_SE);
|
||||
} else if (rotation == 1) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_NE);
|
||||
remove(x + 1, z + 1, FLAG_BLOCK_PROJECTILE_SW);
|
||||
} else if (rotation == 2) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_SE);
|
||||
remove(x + 1, z - 1, FLAG_BLOCK_PROJECTILE_NW);
|
||||
} else if (rotation == 3) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_SW);
|
||||
remove(x - 1, z - 1, FLAG_BLOCK_PROJECTILE_NE);
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (rotation == 0) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_W|FLAG_BLOCK_PROJECTILE_N);
|
||||
remove(x - 1, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
remove(x, z + 1, FLAG_BLOCK_PROJECTILE_S);
|
||||
} else if (rotation == 1) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_E|FLAG_BLOCK_PROJECTILE_N);
|
||||
remove(x, z + 1, FLAG_BLOCK_PROJECTILE_S);
|
||||
remove(x + 1, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
} else if (rotation == 2) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_E|FLAG_BLOCK_PROJECTILE_S);
|
||||
remove(x + 1, z, FLAG_BLOCK_PROJECTILE_W);
|
||||
remove(x, z - 1, FLAG_BLOCK_PROJECTILE_N);
|
||||
} else if (rotation == 3) {
|
||||
remove(x, z, FLAG_BLOCK_PROJECTILE_W|FLAG_BLOCK_PROJECTILE_S);
|
||||
remove(x, z - 1, FLAG_BLOCK_PROJECTILE_N);
|
||||
remove(x - 1, z, FLAG_BLOCK_PROJECTILE_E);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(int rotation, int sizeX, int x0, int z0, int sizeZ, boolean projectiles) {
|
||||
int flags = FLAG_BLOCK_ENTITY;
|
||||
|
||||
if (projectiles) {
|
||||
flags += FLAG_BLOCK_PROJECTILE;
|
||||
}
|
||||
|
||||
if ((rotation == 1) || (rotation == 3)) {
|
||||
int tmp = sizeX;
|
||||
sizeX = sizeZ;
|
||||
sizeZ = tmp;
|
||||
}
|
||||
for (int x = x0; x < (x0 + sizeX); x++) {
|
||||
if ((x >= 0) && (x < this.sizeX)) {
|
||||
for (int z = z0; z < (z0 + sizeZ); z++) {
|
||||
if ((z >= 0) && (z < this.sizeZ)) {
|
||||
remove(x, z, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(int x, int z, int flags) {
|
||||
this.flags[x][z] &= 0xffffff - flags;
|
||||
}
|
||||
|
||||
public void removeSolid(int x, int z) {
|
||||
flags[x][z] &= 0xdfffff;
|
||||
}
|
||||
|
||||
public boolean reachedDestination(int sx, int sz, int dx, int dz, int rotation, int type) {
|
||||
if ((sx == dx) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == 0) {
|
||||
if (rotation == 0) {
|
||||
if ((sx == (dx - 1)) && (sz == dz)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0);
|
||||
}
|
||||
} else if (rotation == 1) {
|
||||
if ((sx == dx) && (sz == (dz + 1))) {
|
||||
return true;
|
||||
} else if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0);
|
||||
}
|
||||
} else if (rotation == 2) {
|
||||
if ((sx == (dx + 1)) && (sz == dz)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0);
|
||||
}
|
||||
} else if (rotation == 3) {
|
||||
if ((sx == dx) && (sz == (dz - 1))) {
|
||||
return true;
|
||||
} else if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0);
|
||||
}
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (rotation == 0) {
|
||||
if ((sx == (dx - 1)) && (sz == dz)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz + 1))) {
|
||||
return true;
|
||||
} else if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0);
|
||||
}
|
||||
} else if (rotation == 1) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz + 1))) {
|
||||
return true;
|
||||
} else if ((sx == (dx + 1)) && (sz == dz)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0);
|
||||
}
|
||||
} else if (rotation == 2) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == (dx + 1)) && (sz == dz)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1));
|
||||
}
|
||||
} else if (rotation == 3) {
|
||||
if ((sx == (dx - 1)) && (sz == dz)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1));
|
||||
}
|
||||
}
|
||||
} else if (type == 9) {
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_S) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_N) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_E) == 0)) {
|
||||
return true;
|
||||
}
|
||||
return (sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_W) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean reachedWall(int sx, int sz, int dx, int dz, int type, int rotation) {
|
||||
if ((sx == dx) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((type == 6) || (type == 7)) {
|
||||
if (type == 7) {
|
||||
rotation = (rotation + 2) & 3;
|
||||
}
|
||||
if (rotation == 0) {
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_W) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_N) == 0);
|
||||
}
|
||||
} else if (rotation == 1) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_E) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_N) == 0);
|
||||
}
|
||||
} else if (rotation == 2) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_E) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_S) == 0);
|
||||
}
|
||||
} else if (rotation == 3) {
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_W) == 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return (sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_S) == 0);
|
||||
}
|
||||
}
|
||||
} else if (type == 8) {
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_S) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_N) == 0)) {
|
||||
return true;
|
||||
} else if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_E) == 0)) {
|
||||
return true;
|
||||
}
|
||||
return (sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & FLAG_BLOCK_ENTITY_W) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean reachedLoc(int srcX, int srcZ, int dstX, int dstZ, int dstSizeX, int dstSizeZ, int interactionSides) {
|
||||
int maxX = (dstX + dstSizeX) - 1;
|
||||
int maxZ = (dstZ + dstSizeZ) - 1;
|
||||
|
||||
if ((srcX >= dstX) && (srcX <= maxX) && (srcZ >= dstZ) && (srcZ <= maxZ)) {
|
||||
return true;
|
||||
} else if ((srcX == (dstX - 1)) && (srcZ >= dstZ) && (srcZ <= maxZ) && ((this.flags[srcX][srcZ] & FLAG_BLOCK_ENTITY_E) == 0) && ((interactionSides & 8) == 0)) {
|
||||
return true;
|
||||
} else if ((srcX == (maxX + 1)) && (srcZ >= dstZ) && (srcZ <= maxZ) && ((this.flags[srcX][srcZ] & FLAG_BLOCK_ENTITY_W) == 0) && ((interactionSides & 2) == 0)) {
|
||||
return true;
|
||||
} else if ((srcZ == (dstZ - 1)) && (srcX >= dstX) && (srcX <= maxX) && ((this.flags[srcX][srcZ] & FLAG_BLOCK_ENTITY_N) == 0) && ((interactionSides & 4) == 0)) {
|
||||
return true;
|
||||
}
|
||||
return (srcZ == (maxZ + 1)) && (srcX >= dstX) && (srcX <= maxX) && ((this.flags[srcX][srcZ] & FLAG_BLOCK_ENTITY_S) == 0) && ((interactionSides & 1) == 0);
|
||||
}
|
||||
|
||||
}
|
||||
+72
-71
@@ -607,7 +607,7 @@ public class Game extends GameShell {
|
||||
public int chatbackInputType;
|
||||
public int song;
|
||||
public boolean songFading = true;
|
||||
public SceneCollisionMap[] levelCollisionMap = new SceneCollisionMap[4];
|
||||
public CollisionMap[] levelCollisionMap = new CollisionMap[4];
|
||||
public boolean redrawPrivacySettings = false;
|
||||
public int[] sceneMapIndex;
|
||||
public int[] sceneMapLandFile;
|
||||
@@ -735,7 +735,7 @@ public class Game extends GameShell {
|
||||
scene = new Scene(104, 104, levelHeightmap, 4);
|
||||
|
||||
for (int level = 0; level < 4; level++) {
|
||||
levelCollisionMap[level] = new SceneCollisionMap(104, 104);
|
||||
levelCollisionMap[level] = new CollisionMap(104, 104);
|
||||
}
|
||||
|
||||
imageMinimap = new Image24(512, 512);
|
||||
@@ -1785,11 +1785,11 @@ public class Game extends GameShell {
|
||||
if ((mapX == minMapX) || (mapX == maxMapX) || (mapZ == minMapZ) || (mapZ == maxMapZ)) {
|
||||
int mapFile = ondemand.getMapFile(0, mapX, mapZ);
|
||||
if (mapFile != -1) {
|
||||
ondemand.method560(mapFile, 3);
|
||||
ondemand.prefetch(mapFile, 3);
|
||||
}
|
||||
int locFile = ondemand.getMapFile(1, mapX, mapZ);
|
||||
if (locFile != -1) {
|
||||
ondemand.method560(locFile, 3);
|
||||
ondemand.prefetch(locFile, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2068,7 +2068,7 @@ public class Game extends GameShell {
|
||||
bitset += 0x80000000;
|
||||
}
|
||||
|
||||
scene.pushTemporary(npc, currentLevel, npc.x, npc.z, getHeightmapY(currentLevel, npc.x, npc.z), npc.yaw, bitset, npc.needsForwardDrawPadding, ((npc.size - 1) * 64) + 60);
|
||||
scene.addTemporary(npc, currentLevel, npc.x, npc.z, getHeightmapY(currentLevel, npc.x, npc.z), npc.yaw, bitset, npc.needsForwardDrawPadding, ((npc.size - 1) * 64) + 60);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3225,7 +3225,7 @@ public class Game extends GameShell {
|
||||
if ((player.locModel != null) && (loopCycle >= player.locStartCycle) && (loopCycle < player.locStopCycle)) {
|
||||
player.lowmem = false;
|
||||
player.y = getHeightmapY(currentLevel, player.x, player.z);
|
||||
scene.pushTemporary(player, currentLevel, player.minSceneTileX, player.minSceneTileZ, player.maxSceneTileX, player.maxSceneTileZ, player.x, player.z, player.y, player.yaw, index);
|
||||
scene.addTemporary(player, currentLevel, player.minSceneTileX, player.minSceneTileZ, player.maxSceneTileX, player.maxSceneTileZ, player.x, player.z, player.y, player.yaw, index);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3237,7 +3237,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
player.y = getHeightmapY(currentLevel, player.x, player.z);
|
||||
scene.pushTemporary(player, currentLevel, player.x, player.z, player.y, player.yaw, index, player.needsForwardDrawPadding, 60);
|
||||
scene.addTemporary(player, currentLevel, player.x, player.z, player.y, player.yaw, index, player.needsForwardDrawPadding, 60);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3894,7 +3894,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
}
|
||||
proj.update(delta);
|
||||
scene.pushTemporary(proj, currentLevel, (int) proj.x, (int) proj.z, (int) proj.y, proj.yaw, -1, false, 60);
|
||||
scene.addTemporary(proj, currentLevel, (int) proj.x, (int) proj.z, (int) proj.y, proj.yaw, -1, false, 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4020,7 +4020,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
}
|
||||
} while ((request.store != 93) || !ondemand.method564(request.file));
|
||||
SceneBuilder.method173(new Buffer(request.data), ondemand);
|
||||
SceneBuilder.prefetchLocs(new Buffer(request.data), ondemand);
|
||||
} while (true);
|
||||
}
|
||||
|
||||
@@ -5984,8 +5984,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
} else {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if ((type.groundOptions != null) && (type.groundOptions[option] != null)) {
|
||||
menuOption[menuSize] = type.groundOptions[option] + " @lre@" + type.name;
|
||||
if ((type.options != null) && (type.options[option] != null)) {
|
||||
menuOption[menuSize] = type.options[option] + " @lre@" + type.name;
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 652;
|
||||
@@ -7400,17 +7400,17 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
if (locType != 0) {
|
||||
if (((locType < 5) || (locType == 10)) && levelCollisionMap[currentLevel].method219(x, z, dx, dz, locAngle, locType - 1)) {
|
||||
if (((locType < 5) || (locType == 10)) && levelCollisionMap[currentLevel].reachedDestination(x, z, dx, dz, locAngle, locType - 1)) {
|
||||
arrived = true;
|
||||
break;
|
||||
}
|
||||
if ((locType < 10) && levelCollisionMap[currentLevel].method220(x, z, dx, dz, locType - 1, locAngle)) {
|
||||
if ((locType < 10) && levelCollisionMap[currentLevel].reachedWall(x, z, dx, dz, locType - 1, locAngle)) {
|
||||
arrived = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((locWidth != 0) && (locLength != 0) && levelCollisionMap[currentLevel].method221(x, z, dx, dz, locWidth, locLength, locInteractionFlags)) {
|
||||
if ((locWidth != 0) && (locLength != 0) && levelCollisionMap[currentLevel].reachedLoc(x, z, dx, dz, locWidth, locLength, locInteractionFlags)) {
|
||||
arrived = true;
|
||||
break;
|
||||
}
|
||||
@@ -7758,10 +7758,10 @@ public class Game extends GameShell {
|
||||
menuSize++;
|
||||
}
|
||||
} else {
|
||||
if (type.op != null) {
|
||||
if (type.options != null) {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if ((type.op[option] != null) && !type.op[option].equalsIgnoreCase("attack")) {
|
||||
menuOption[menuSize] = type.op[option] + " @yel@" + text;
|
||||
if ((type.options[option] != null) && !type.options[option].equalsIgnoreCase("attack")) {
|
||||
menuOption[menuSize] = type.options[option] + " @yel@" + text;
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 20;
|
||||
@@ -7782,15 +7782,15 @@ public class Game extends GameShell {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type.op != null) {
|
||||
if (type.options != null) {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if ((type.op[option] != null) && type.op[option].equalsIgnoreCase("attack")) {
|
||||
if ((type.options[option] != null) && type.options[option].equalsIgnoreCase("attack")) {
|
||||
int offset = 0;
|
||||
|
||||
if (type.level > localPlayer.combatLevel) {
|
||||
offset = 2000;
|
||||
}
|
||||
menuOption[menuSize] = type.op[option] + " @yel@" + text;
|
||||
menuOption[menuSize] = type.options[option] + " @yel@" + text;
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 20 + offset;
|
||||
@@ -8565,7 +8565,7 @@ public class Game extends GameShell {
|
||||
|
||||
if (chatInterfaceID == -1) {
|
||||
chatInterface.scrollPosition = chatScrollHeight - chatScrollOffset - 77;
|
||||
|
||||
|
||||
if ((super.mouseX > 448) && (super.mouseX < 560) && (super.mouseY > 332)) {
|
||||
handleScrollInput(463, 77, super.mouseX - 17, super.mouseY - 357, chatInterface, 0, false, chatScrollHeight);
|
||||
}
|
||||
@@ -8818,7 +8818,7 @@ public class Game extends GameShell {
|
||||
if (anim.seqComplete) {
|
||||
anim.unlink();
|
||||
} else {
|
||||
scene.pushTemporary(anim, anim.level, anim.x, anim.z, anim.y, 0, -1, false, 60);
|
||||
scene.addTemporary(anim, anim.level, anim.x, anim.z, anim.y, 0, -1, false, 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9898,43 +9898,43 @@ public class Game extends GameShell {
|
||||
int arith = 0;
|
||||
|
||||
do {
|
||||
int op = script[pos++];
|
||||
int reg = 0;
|
||||
int opcode = script[pos++];
|
||||
int register = 0;
|
||||
byte nextArithmetic = 0;
|
||||
|
||||
if (op == 0) {
|
||||
if (opcode == 0) {
|
||||
return acc;
|
||||
} else if (op == 1) { // load_skill_level {skill}
|
||||
reg = skillLevel[script[pos++]];
|
||||
} else if (op == 2) { // load_skill_base_level {skill}
|
||||
reg = skillBaseLevel[script[pos++]];
|
||||
} else if (op == 3) { // load_skill_exp {skill}
|
||||
reg = skillExperience[script[pos++]];
|
||||
} else if (op == 4) {// load_inv_count {interface id} {obj id}
|
||||
} else if (opcode == 1) { // load_skill_level {skill}
|
||||
register = skillLevel[script[pos++]];
|
||||
} else if (opcode == 2) { // load_skill_base_level {skill}
|
||||
register = skillBaseLevel[script[pos++]];
|
||||
} else if (opcode == 3) { // load_skill_exp {skill}
|
||||
register = skillExperience[script[pos++]];
|
||||
} else if (opcode == 4) {// load_inv_count {interface id} {obj id}
|
||||
IfType inventory = IfType.instances[script[pos++]];
|
||||
int objID = script[pos++];
|
||||
if ((objID >= 0) && (objID < ObjType.count) && (!ObjType.get(objID).members || members)) {
|
||||
for (int slot = 0; slot < inventory.inventorySlotObjID.length; slot++) {
|
||||
if (inventory.inventorySlotObjID[slot] == (objID + 1)) {
|
||||
reg += inventory.inventorySlotObjCount[slot];
|
||||
register += inventory.inventorySlotObjCount[slot];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (op == 5) { // load_var {id}
|
||||
reg = varps[script[pos++]];
|
||||
} else if (op == 6) { // load_next_level_xp {skill}
|
||||
reg = levelExperience[skillBaseLevel[script[pos++]] - 1];
|
||||
} else if (op == 7) {
|
||||
reg = (varps[script[pos++]] * 100) / 46875;
|
||||
} else if (op == 8) { // load_combat_level
|
||||
reg = localPlayer.combatLevel;
|
||||
} else if (op == 9) { // load_total_level
|
||||
} else if (opcode == 5) { // load_var {id}
|
||||
register = varps[script[pos++]];
|
||||
} else if (opcode == 6) { // load_next_level_xp {skill}
|
||||
register = levelExperience[skillBaseLevel[script[pos++]] - 1];
|
||||
} else if (opcode == 7) {
|
||||
register = (varps[script[pos++]] * 100) / 46875;
|
||||
} else if (opcode == 8) { // load_combat_level
|
||||
register = localPlayer.combatLevel;
|
||||
} else if (opcode == 9) { // load_total_level
|
||||
for (int skill = 0; skill < Skill.COUNT; skill++) {
|
||||
if (Skill.ENABLED[skill]) {
|
||||
reg += skillBaseLevel[skill];
|
||||
register += skillBaseLevel[skill];
|
||||
}
|
||||
}
|
||||
} else if (op == 10) {// load_inv_contains {interface id} {obj id}
|
||||
} else if (opcode == 10) {// load_inv_contains {interface id} {obj id}
|
||||
IfType c = IfType.instances[script[pos++]];
|
||||
int objID = script[pos++] + 1;
|
||||
if ((objID >= 0) && (objID < ObjType.count) && (!ObjType.get(objID).members || members)) {
|
||||
@@ -9942,48 +9942,48 @@ public class Game extends GameShell {
|
||||
if (c.inventorySlotObjID[slot] != objID) {
|
||||
continue;
|
||||
}
|
||||
reg = 999999999;
|
||||
register = 999999999;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (op == 11) { // load_energy
|
||||
reg = energy;
|
||||
} else if (op == 12) { // load_weight
|
||||
reg = weightCarried;
|
||||
} else if (op == 13) {// load_bool {varp} {bit: 0..31}
|
||||
} else if (opcode == 11) { // load_energy
|
||||
register = energy;
|
||||
} else if (opcode == 12) { // load_weight
|
||||
register = weightCarried;
|
||||
} else if (opcode == 13) {// load_bool {varp} {bit: 0..31}
|
||||
int varp = varps[script[pos++]];
|
||||
int bit = script[pos++];
|
||||
reg = ((varp & (1 << bit)) == 0) ? 0 : 1;
|
||||
} else if (op == 14) {// load_varbit {varbit}
|
||||
register = ((varp & (1 << bit)) == 0) ? 0 : 1;
|
||||
} else if (opcode == 14) {// load_varbit {varbit}
|
||||
VarbitType varbit = VarbitType.instances[script[pos++]];
|
||||
int lsb = varbit.lsb;
|
||||
reg = (varps[varbit.varp] >> lsb) & BITMASK[varbit.msb - lsb];
|
||||
} else if (op == 15) { // sub
|
||||
register = (varps[varbit.varp] >> lsb) & BITMASK[varbit.msb - lsb];
|
||||
} else if (opcode == 15) { // sub
|
||||
nextArithmetic = 1;
|
||||
} else if (op == 16) { // div
|
||||
} else if (opcode == 16) { // div
|
||||
nextArithmetic = 2;
|
||||
} else if (op == 17) { // mul
|
||||
} else if (opcode == 17) { // mul
|
||||
nextArithmetic = 3;
|
||||
} else if (op == 18) { // load_world_x
|
||||
reg = (localPlayer.x >> 7) + sceneBaseTileX;
|
||||
} else if (op == 19) { // load_world_z
|
||||
reg = (localPlayer.z >> 7) + sceneBaseTileZ;
|
||||
} else if (op == 20) { // load {value}
|
||||
reg = script[pos++];
|
||||
} else if (opcode == 18) { // load_world_x
|
||||
register = (localPlayer.x >> 7) + sceneBaseTileX;
|
||||
} else if (opcode == 19) { // load_world_z
|
||||
register = (localPlayer.z >> 7) + sceneBaseTileZ;
|
||||
} else if (opcode == 20) { // load {value}
|
||||
register = script[pos++];
|
||||
}
|
||||
|
||||
if (nextArithmetic == 0) {
|
||||
if (arith == 0) {
|
||||
acc += reg;
|
||||
acc += register;
|
||||
}
|
||||
if (arith == 1) {
|
||||
acc -= reg;
|
||||
acc -= register;
|
||||
}
|
||||
if ((arith == 2) && (reg != 0)) {
|
||||
acc /= reg;
|
||||
if ((arith == 2) && (register != 0)) {
|
||||
acc /= register;
|
||||
}
|
||||
if (arith == 3) {
|
||||
acc *= reg;
|
||||
acc *= register;
|
||||
}
|
||||
arith = 0;
|
||||
} else {
|
||||
@@ -11164,7 +11164,7 @@ public class Game extends GameShell {
|
||||
scene.removeWall(x, level, z);
|
||||
LocType type = LocType.get(otherID);
|
||||
if (type.solid) {
|
||||
levelCollisionMap[level].remove(otherRotation, otherKind, type.blocksProjectiles, x, z);
|
||||
levelCollisionMap[level].remove(x, z, otherRotation, otherKind, type.blocksProjectiles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11188,8 +11188,9 @@ public class Game extends GameShell {
|
||||
if (classID == 3) {
|
||||
scene.removeGroundDecoration(level, x, z);
|
||||
LocType type = LocType.get(otherID);
|
||||
|
||||
if (type.solid && type.interactable) {
|
||||
levelCollisionMap[level].method218(z, x);
|
||||
levelCollisionMap[level].removeSolid(x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11656,10 +11657,10 @@ public class Game extends GameShell {
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
iface.modelCategory = 3;
|
||||
|
||||
if (localPlayer.npcType == null) {
|
||||
if (localPlayer.transmogrify == null) {
|
||||
iface.modelID = (localPlayer.colors[0] << 25) + (localPlayer.colors[4] << 20) + (localPlayer.appearances[0] << 15) + (localPlayer.appearances[8] << 10) + (localPlayer.appearances[11] << 5) + localPlayer.appearances[1];
|
||||
} else {
|
||||
iface.modelID = (int) (0x12345678L + localPlayer.npcType.uid);
|
||||
iface.modelID = (int) (0x12345678L + localPlayer.transmogrify.uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,12 +153,12 @@ public class LocType {
|
||||
overrideTypeIDs = null;
|
||||
}
|
||||
|
||||
public void method574(OnDemand onDemand) {
|
||||
public void prefetch(OnDemand onDemand) {
|
||||
if (modelIDs == null) {
|
||||
return;
|
||||
}
|
||||
for (int k : modelIDs) {
|
||||
onDemand.method560(k & 0xffff, 0);
|
||||
for (int modelID : modelIDs) {
|
||||
onDemand.prefetch(modelID & 0xffff, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+76
-68
@@ -62,7 +62,7 @@ public class NPCType {
|
||||
public int varpID = -1;
|
||||
public int level = -1;
|
||||
public String name;
|
||||
public String[] op;
|
||||
public String[] options;
|
||||
public int seqWalkID = -1;
|
||||
public byte size = 1;
|
||||
public int[] colorDst;
|
||||
@@ -75,14 +75,14 @@ public class NPCType {
|
||||
public int turnSpeed = 32;
|
||||
public int seqTurnLeftID = -1;
|
||||
public boolean interactable = true;
|
||||
public int anInt85;
|
||||
public int anInt86 = 128;
|
||||
public int lightAmbient;
|
||||
public int scaleZ = 128;
|
||||
public boolean showOnMinimap = true;
|
||||
public int[] overrides;
|
||||
public byte[] desc;
|
||||
public int unusedInt1 = -1;
|
||||
public int anInt91 = 128;
|
||||
public int anInt92;
|
||||
public int scaleXY = 128;
|
||||
public int lightAttenuation;
|
||||
/**
|
||||
* Causes the npc to render on top of other npcs.
|
||||
*/
|
||||
@@ -206,123 +206,131 @@ public class NPCType {
|
||||
}
|
||||
|
||||
model.createLabelReferences();
|
||||
model.calculateNormals(64 + anInt85, 850 + anInt92, -30, -50, -30, true);
|
||||
model.calculateNormals(64 + lightAmbient, 850 + lightAttenuation, -30, -50, -30, true);
|
||||
modelCache.put(uid, model);
|
||||
}
|
||||
|
||||
Model model_1 = Model.EMPTY;
|
||||
model_1.set(model, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID));
|
||||
Model tmp = Model.EMPTY;
|
||||
tmp.set(model, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID));
|
||||
|
||||
if ((primaryTransformID != -1) && (secondaryTransformID != -1)) {
|
||||
model_1.applyTransforms(primaryTransformID, secondaryTransformID, seqMask);
|
||||
tmp.applyTransforms(primaryTransformID, secondaryTransformID, seqMask);
|
||||
} else if (primaryTransformID != -1) {
|
||||
model_1.applyTransform(primaryTransformID);
|
||||
tmp.applyTransform(primaryTransformID);
|
||||
}
|
||||
|
||||
if ((anInt91 != 128) || (anInt86 != 128)) {
|
||||
model_1.scale(anInt91, anInt91, anInt86);
|
||||
if ((scaleXY != 128) || (scaleZ != 128)) {
|
||||
tmp.scale(scaleXY, scaleXY, scaleZ);
|
||||
}
|
||||
model_1.calculateBoundsCylinder();
|
||||
model_1.labelFaces = null;
|
||||
model_1.labelVertices = null;
|
||||
|
||||
tmp.calculateBoundsCylinder();
|
||||
tmp.labelFaces = null;
|
||||
tmp.labelVertices = null;
|
||||
|
||||
if (size == 1) {
|
||||
model_1.pickable = true;
|
||||
tmp.pickable = true;
|
||||
}
|
||||
return model_1;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public void read(Buffer buffer) {
|
||||
do {
|
||||
int i = buffer.read8U();
|
||||
if (i == 0) {
|
||||
int opcode = buffer.read8U();
|
||||
|
||||
if (opcode == 0) {
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
int j = buffer.read8U();
|
||||
modelIDs = new int[j];
|
||||
for (int j1 = 0; j1 < j; j1++) {
|
||||
modelIDs[j1] = buffer.read16U();
|
||||
|
||||
if (opcode == 1) {
|
||||
int modelCount = buffer.read8U();
|
||||
modelIDs = new int[modelCount];
|
||||
for (int i = 0; i < modelCount; i++) {
|
||||
modelIDs[i] = buffer.read16U();
|
||||
}
|
||||
} else if (i == 2) {
|
||||
} else if (opcode == 2) {
|
||||
name = buffer.readString();
|
||||
} else if (i == 3) {
|
||||
} else if (opcode == 3) {
|
||||
desc = buffer.readStringRaw();
|
||||
} else if (i == 12) {
|
||||
} else if (opcode == 12) {
|
||||
size = buffer.read();
|
||||
} else if (i == 13) {
|
||||
} else if (opcode == 13) {
|
||||
seqStandID = buffer.read16U();
|
||||
} else if (i == 14) {
|
||||
} else if (opcode == 14) {
|
||||
seqWalkID = buffer.read16U();
|
||||
} else if (i == 17) {
|
||||
} else if (opcode == 17) {
|
||||
seqWalkID = buffer.read16U();
|
||||
seqTurnAroundID = buffer.read16U();
|
||||
seqTurnLeftID = buffer.read16U();
|
||||
seqTurnRightID = buffer.read16U();
|
||||
} else if ((i >= 30) && (i < 40)) {
|
||||
if (op == null) {
|
||||
op = new String[5];
|
||||
} else if ((opcode >= 30) && (opcode < 40)) {
|
||||
if (options == null) {
|
||||
options = new String[5];
|
||||
}
|
||||
op[i - 30] = buffer.readString();
|
||||
if (op[i - 30].equalsIgnoreCase("hidden")) {
|
||||
op[i - 30] = null;
|
||||
options[opcode - 30] = buffer.readString();
|
||||
if (options[opcode - 30].equalsIgnoreCase("hidden")) {
|
||||
options[opcode - 30] = null;
|
||||
}
|
||||
} else if (i == 40) {
|
||||
int k = buffer.read8U();
|
||||
colorSrc = new int[k];
|
||||
colorDst = new int[k];
|
||||
for (int k1 = 0; k1 < k; k1++) {
|
||||
colorSrc[k1] = buffer.read16U();
|
||||
colorDst[k1] = buffer.read16U();
|
||||
} else if (opcode == 40) {
|
||||
int recolorCount = buffer.read8U();
|
||||
colorSrc = new int[recolorCount];
|
||||
colorDst = new int[recolorCount];
|
||||
for (int i = 0; i < recolorCount; i++) {
|
||||
colorSrc[i] = buffer.read16U();
|
||||
colorDst[i] = buffer.read16U();
|
||||
}
|
||||
} else if (i == 60) {
|
||||
} else if (opcode == 60) {
|
||||
int l = buffer.read8U();
|
||||
headModelIDs = new int[l];
|
||||
for (int l1 = 0; l1 < l; l1++) {
|
||||
headModelIDs[l1] = buffer.read16U();
|
||||
}
|
||||
} else if (i == 90) {
|
||||
} else if (opcode == 90) {
|
||||
unusedInt2 = buffer.read16U();
|
||||
} else if (i == 91) {
|
||||
} else if (opcode == 91) {
|
||||
unusedInt0 = buffer.read16U();
|
||||
} else if (i == 92) {
|
||||
} else if (opcode == 92) {
|
||||
unusedInt1 = buffer.read16U();
|
||||
} else if (i == 93) {
|
||||
} else if (opcode == 93) {
|
||||
showOnMinimap = false;
|
||||
} else if (i == 95) {
|
||||
} else if (opcode == 95) {
|
||||
level = buffer.read16U();
|
||||
} else if (i == 97) {
|
||||
anInt91 = buffer.read16U();
|
||||
} else if (i == 98) {
|
||||
anInt86 = buffer.read16U();
|
||||
} else if (i == 99) {
|
||||
} else if (opcode == 97) {
|
||||
scaleXY = buffer.read16U();
|
||||
} else if (opcode == 98) {
|
||||
scaleZ = buffer.read16U();
|
||||
} else if (opcode == 99) {
|
||||
important = true;
|
||||
} else if (i == 100) {
|
||||
anInt85 = buffer.read();
|
||||
} else if (i == 101) {
|
||||
anInt92 = buffer.read() * 5;
|
||||
} else if (i == 102) {
|
||||
} else if (opcode == 100) {
|
||||
lightAmbient = buffer.read();
|
||||
} else if (opcode == 101) {
|
||||
lightAttenuation = buffer.read() * 5;
|
||||
} else if (opcode == 102) {
|
||||
headicon = buffer.read16U();
|
||||
} else if (i == 103) {
|
||||
} else if (opcode == 103) {
|
||||
turnSpeed = buffer.read16U();
|
||||
} else if (i == 106) {
|
||||
} else if (opcode == 106) {
|
||||
varbitID = buffer.read16U();
|
||||
|
||||
if (varbitID == 65535) {
|
||||
varbitID = -1;
|
||||
}
|
||||
varpID = buffer.read16U();
|
||||
|
||||
if (varpID == 65535) {
|
||||
varpID = -1;
|
||||
}
|
||||
int i1 = buffer.read8U();
|
||||
overrides = new int[i1 + 1];
|
||||
for (int i2 = 0; i2 <= i1; i2++) {
|
||||
overrides[i2] = buffer.read16U();
|
||||
if (overrides[i2] == 65535) {
|
||||
overrides[i2] = -1;
|
||||
|
||||
int overrideCount = buffer.read8U();
|
||||
overrides = new int[overrideCount + 1];
|
||||
|
||||
for (int i = 0; i <= overrideCount; i++) {
|
||||
overrides[i] = buffer.read16U();
|
||||
if (overrides[i] == 65535) {
|
||||
overrides[i] = -1;
|
||||
}
|
||||
}
|
||||
} else if (i == 107) {
|
||||
} else if (opcode == 107) {
|
||||
interactable = false;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
+185
-156
@@ -29,10 +29,10 @@ public class ObjType {
|
||||
Buffer idx = new Buffer(archive.read("obj.idx"));
|
||||
count = idx.read16U();
|
||||
typeOffset = new int[count];
|
||||
int i = 2;
|
||||
int offset = 2;
|
||||
for (int j = 0; j < count; j++) {
|
||||
typeOffset[j] = i;
|
||||
i += idx.read16U();
|
||||
typeOffset[j] = offset;
|
||||
offset += idx.read16U();
|
||||
}
|
||||
cached = new ObjType[10];
|
||||
for (int k = 0; k < 10; k++) {
|
||||
@@ -58,7 +58,7 @@ public class ObjType {
|
||||
if (!Game.members && type.members) {
|
||||
type.name = "Members Object";
|
||||
type.examine = "Login to a members' server to use this object.".getBytes();
|
||||
type.groundOptions = null;
|
||||
type.options = null;
|
||||
type.inventoryOptions = null;
|
||||
type.team = 0;
|
||||
}
|
||||
@@ -81,15 +81,15 @@ public class ObjType {
|
||||
|
||||
ObjType type = get(id);
|
||||
|
||||
if (type.stackIDs == null) {
|
||||
if (type.stackID == null) {
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
if (amount > 1) {
|
||||
int newID = -1;
|
||||
for (int j1 = 0; j1 < 10; j1++) {
|
||||
if ((amount >= type.stackAmount[j1]) && (type.stackAmount[j1] != 0)) {
|
||||
newID = type.stackIDs[j1];
|
||||
if ((amount >= type.stackCount[j1]) && (type.stackCount[j1] != 0)) {
|
||||
newID = type.stackID[j1];
|
||||
}
|
||||
}
|
||||
if (newID != -1) {
|
||||
@@ -234,37 +234,37 @@ public class ObjType {
|
||||
public int id = -1;
|
||||
public int[] dstColor;
|
||||
public boolean members;
|
||||
public int femaleModelId2;
|
||||
public int femaleModelID2;
|
||||
public int certificateID;
|
||||
public int femaleModelId1;
|
||||
public int maleModelId0;
|
||||
public int maleHeadModelId1;
|
||||
public int femaleModelID1;
|
||||
public int maleModelID0;
|
||||
public int maleHeadModelID1;
|
||||
public int scaleX;
|
||||
public String[] groundOptions;
|
||||
public String[] options;
|
||||
public int iconOffsetX;
|
||||
public String name;
|
||||
public int femaleHeadModel1;
|
||||
public int femaleHeadModelID1;
|
||||
public int modelID;
|
||||
public int maleHeadModelId0;
|
||||
public int maleHeadModelID0;
|
||||
public boolean stackable;
|
||||
public byte[] examine;
|
||||
public int linkedID;
|
||||
public int iconZoom;
|
||||
public int lightAttenuation;
|
||||
public int maleModelId2;
|
||||
public int maleModelId1;
|
||||
public int maleModelID2;
|
||||
public int maleModelID1;
|
||||
public String[] inventoryOptions;
|
||||
public int iconPitch;
|
||||
public int scaleY;
|
||||
public int scaleZ;
|
||||
public int[] stackIDs;
|
||||
public int[] stackID;
|
||||
public int iconOffsetY;
|
||||
public int lightAmbient;
|
||||
public int femaleHeadModel0;
|
||||
public int femaleHeadModelID0;
|
||||
public int iconYaw;
|
||||
public int unusedInt;
|
||||
public int femaleModelId0;
|
||||
public int[] stackAmount;
|
||||
public int femaleModelID0;
|
||||
public int[] stackCount;
|
||||
public int team;
|
||||
public int iconRoll;
|
||||
public byte maleOffsetY;
|
||||
@@ -273,36 +273,45 @@ public class ObjType {
|
||||
}
|
||||
|
||||
public boolean validateHeadModel(int gender) {
|
||||
int m0 = maleHeadModelId0;
|
||||
int m1 = maleHeadModelId1;
|
||||
int modelID0 = maleHeadModelID0;
|
||||
int modelID1 = maleHeadModelID1;
|
||||
|
||||
if (gender == 1) {
|
||||
m0 = femaleHeadModel0;
|
||||
m1 = femaleHeadModel1;
|
||||
modelID0 = femaleHeadModelID0;
|
||||
modelID1 = femaleHeadModelID1;
|
||||
}
|
||||
if (m0 == -1) {
|
||||
|
||||
if (modelID0 == -1) {
|
||||
return true;
|
||||
}
|
||||
boolean valid = Model.validate(m0);
|
||||
if ((m1 != -1) && !Model.validate(m1)) {
|
||||
|
||||
boolean valid = Model.validate(modelID0);
|
||||
|
||||
if ((modelID1 != -1) && !Model.validate(modelID1)) {
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public Model getHeadModel(int gender) {
|
||||
int m0 = maleHeadModelId0;
|
||||
int m1 = maleHeadModelId1;
|
||||
int modelID0 = maleHeadModelID0;
|
||||
int modelID1 = maleHeadModelID1;
|
||||
|
||||
if (gender == 1) {
|
||||
m0 = femaleHeadModel0;
|
||||
m1 = femaleHeadModel1;
|
||||
modelID0 = femaleHeadModelID0;
|
||||
modelID1 = femaleHeadModelID1;
|
||||
}
|
||||
if (m0 == -1) {
|
||||
|
||||
if (modelID0 == -1) {
|
||||
return null;
|
||||
}
|
||||
Model model = Model.tryGet(m0);
|
||||
if (m1 != -1) {
|
||||
model = new Model(2, new Model[]{model, Model.tryGet(m1)});
|
||||
|
||||
Model model = Model.tryGet(modelID0);
|
||||
|
||||
if (modelID1 != -1) {
|
||||
model = new Model(2, new Model[]{model, Model.tryGet(modelID1)});
|
||||
}
|
||||
|
||||
if (srcColor != null) {
|
||||
for (int i = 0; i < srcColor.length; i++) {
|
||||
model.recolor(srcColor[i], dstColor[i]);
|
||||
@@ -312,49 +321,55 @@ public class ObjType {
|
||||
}
|
||||
|
||||
public boolean validateWornModel(int gender) {
|
||||
int m0 = maleModelId0;
|
||||
int m1 = maleModelId1;
|
||||
int m2 = maleModelId2;
|
||||
int modelID0 = maleModelID0;
|
||||
int modelID1 = maleModelID1;
|
||||
int modelID2 = maleModelID2;
|
||||
|
||||
if (gender == 1) {
|
||||
m0 = femaleModelId0;
|
||||
m1 = femaleModelId1;
|
||||
m2 = femaleModelId2;
|
||||
modelID0 = femaleModelID0;
|
||||
modelID1 = femaleModelID1;
|
||||
modelID2 = femaleModelID2;
|
||||
}
|
||||
if (m0 == -1) {
|
||||
|
||||
if (modelID0 == -1) {
|
||||
return true;
|
||||
}
|
||||
boolean valid = Model.validate(m0);
|
||||
if ((m1 != -1) && !Model.validate(m1)) {
|
||||
|
||||
boolean valid = Model.validate(modelID0);
|
||||
|
||||
if ((modelID1 != -1) && !Model.validate(modelID1)) {
|
||||
valid = false;
|
||||
}
|
||||
if ((m2 != -1) && !Model.validate(m2)) {
|
||||
|
||||
if ((modelID2 != -1) && !Model.validate(modelID2)) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
public Model getWornModel(int gender) {
|
||||
int m0 = maleModelId0;
|
||||
int m1 = maleModelId1;
|
||||
int m2 = maleModelId2;
|
||||
int modelID0 = maleModelID0;
|
||||
int modelID1 = maleModelID1;
|
||||
int modelID2 = maleModelID2;
|
||||
|
||||
if (gender == 1) {
|
||||
m0 = femaleModelId0;
|
||||
m1 = femaleModelId1;
|
||||
m2 = femaleModelId2;
|
||||
modelID0 = femaleModelID0;
|
||||
modelID1 = femaleModelID1;
|
||||
modelID2 = femaleModelID2;
|
||||
}
|
||||
|
||||
if (m0 == -1) {
|
||||
if (modelID0 == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Model model = Model.tryGet(m0);
|
||||
Model model = Model.tryGet(modelID0);
|
||||
|
||||
if (m1 != -1) {
|
||||
if (m2 != -1) {
|
||||
model = new Model(3, new Model[]{model, Model.tryGet(m1), Model.tryGet(m2)});
|
||||
if (modelID1 != -1) {
|
||||
if (modelID2 != -1) {
|
||||
model = new Model(3, new Model[]{model, Model.tryGet(modelID1), Model.tryGet(modelID2)});
|
||||
} else {
|
||||
model = new Model(2, new Model[]{model, Model.tryGet(m1)});
|
||||
model = new Model(2, new Model[]{model, Model.tryGet(modelID1)});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,8 +382,8 @@ public class ObjType {
|
||||
}
|
||||
|
||||
if (srcColor != null) {
|
||||
for (int i1 = 0; i1 < srcColor.length; i1++) {
|
||||
model.recolor(srcColor[i1], dstColor[i1]);
|
||||
for (int i = 0; i < srcColor.length; i++) {
|
||||
model.recolor(srcColor[i], dstColor[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,22 +406,22 @@ public class ObjType {
|
||||
stackable = false;
|
||||
cost = 1;
|
||||
members = false;
|
||||
groundOptions = null;
|
||||
options = null;
|
||||
inventoryOptions = null;
|
||||
maleModelId0 = -1;
|
||||
maleModelId1 = -1;
|
||||
maleModelID0 = -1;
|
||||
maleModelID1 = -1;
|
||||
maleOffsetY = 0;
|
||||
femaleModelId0 = -1;
|
||||
femaleModelId1 = -1;
|
||||
femaleModelID0 = -1;
|
||||
femaleModelID1 = -1;
|
||||
femaleOffsetY = 0;
|
||||
maleModelId2 = -1;
|
||||
femaleModelId2 = -1;
|
||||
maleHeadModelId0 = -1;
|
||||
maleHeadModelId1 = -1;
|
||||
femaleHeadModel0 = -1;
|
||||
femaleHeadModel1 = -1;
|
||||
stackIDs = null;
|
||||
stackAmount = null;
|
||||
maleModelID2 = -1;
|
||||
femaleModelID2 = -1;
|
||||
maleHeadModelID0 = -1;
|
||||
maleHeadModelID1 = -1;
|
||||
femaleHeadModelID0 = -1;
|
||||
femaleHeadModelID1 = -1;
|
||||
stackID = null;
|
||||
stackCount = null;
|
||||
linkedID = -1;
|
||||
certificateID = -1;
|
||||
scaleX = 128;
|
||||
@@ -432,25 +447,30 @@ public class ObjType {
|
||||
name = linked.name;
|
||||
members = linked.members;
|
||||
cost = linked.cost;
|
||||
|
||||
String s = "a";
|
||||
char c = linked.name.charAt(0);
|
||||
|
||||
if ((c == 'A') || (c == 'E') || (c == 'I') || (c == 'O') || (c == 'U')) {
|
||||
s = "an";
|
||||
}
|
||||
|
||||
examine = ("Swap this note at any bank for " + s + " " + linked.name + ".").getBytes();
|
||||
stackable = true;
|
||||
}
|
||||
|
||||
public Model getModel(int amount) {
|
||||
if ((stackIDs != null) && (amount > 1)) {
|
||||
int newID = -1;
|
||||
for (int k = 0; k < 10; k++) {
|
||||
if ((amount >= stackAmount[k]) && (stackAmount[k] != 0)) {
|
||||
newID = stackIDs[k];
|
||||
public Model getModel(int count) {
|
||||
if ((stackID != null) && (count > 1)) {
|
||||
int id = -1;
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if ((count >= stackCount[i]) && (stackCount[i] != 0)) {
|
||||
id = stackID[i];
|
||||
}
|
||||
}
|
||||
if (newID != -1) {
|
||||
return get(newID).getModel(1);
|
||||
|
||||
if (id != -1) {
|
||||
return get(id).getModel(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,8 +491,8 @@ public class ObjType {
|
||||
}
|
||||
|
||||
if (srcColor != null) {
|
||||
for (int l = 0; l < srcColor.length; l++) {
|
||||
model.recolor(srcColor[l], dstColor[l]);
|
||||
for (int i = 0; i < srcColor.length; i++) {
|
||||
model.recolor(srcColor[i], dstColor[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,25 +502,30 @@ public class ObjType {
|
||||
return model;
|
||||
}
|
||||
|
||||
public Model getUnlitModel(int amount) {
|
||||
if ((stackIDs != null) && (amount > 1)) {
|
||||
int j = -1;
|
||||
for (int k = 0; k < 10; k++) {
|
||||
if ((amount >= stackAmount[k]) && (stackAmount[k] != 0)) {
|
||||
j = stackIDs[k];
|
||||
public Model getUnlitModel(int count) {
|
||||
if ((stackID != null) && (count > 1)) {
|
||||
int id = -1;
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if ((count >= stackCount[i]) && (stackCount[i] != 0)) {
|
||||
id = stackID[i];
|
||||
}
|
||||
}
|
||||
if (j != -1) {
|
||||
return get(j).getUnlitModel(1);
|
||||
|
||||
if (id != -1) {
|
||||
return get(id).getUnlitModel(1);
|
||||
}
|
||||
}
|
||||
|
||||
Model model = Model.tryGet(modelID);
|
||||
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (srcColor != null) {
|
||||
for (int l = 0; l < srcColor.length; l++) {
|
||||
model.recolor(srcColor[l], dstColor[l]);
|
||||
for (int i = 0; i < srcColor.length; i++) {
|
||||
model.recolor(srcColor[i], dstColor[i]);
|
||||
}
|
||||
}
|
||||
return model;
|
||||
@@ -508,107 +533,111 @@ public class ObjType {
|
||||
|
||||
public void read(Buffer buffer) {
|
||||
do {
|
||||
int i = buffer.read8U();
|
||||
if (i == 0) {
|
||||
int opcode = buffer.read8U();
|
||||
|
||||
if (opcode == 0) {
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
|
||||
if (opcode == 1) {
|
||||
modelID = buffer.read16U();
|
||||
} else if (i == 2) {
|
||||
} else if (opcode == 2) {
|
||||
name = buffer.readString();
|
||||
} else if (i == 3) {
|
||||
} else if (opcode == 3) {
|
||||
examine = buffer.readStringRaw();
|
||||
} else if (i == 4) {
|
||||
} else if (opcode == 4) {
|
||||
iconZoom = buffer.read16U();
|
||||
} else if (i == 5) {
|
||||
} else if (opcode == 5) {
|
||||
iconPitch = buffer.read16U();
|
||||
} else if (i == 6) {
|
||||
} else if (opcode == 6) {
|
||||
iconYaw = buffer.read16U();
|
||||
} else if (i == 7) {
|
||||
} else if (opcode == 7) {
|
||||
iconOffsetX = buffer.read16U();
|
||||
if (iconOffsetX > 32767) {
|
||||
iconOffsetX -= 0x10000;
|
||||
}
|
||||
} else if (i == 8) {
|
||||
} else if (opcode == 8) {
|
||||
iconOffsetY = buffer.read16U();
|
||||
if (iconOffsetY > 32767) {
|
||||
iconOffsetY -= 0x10000;
|
||||
}
|
||||
} else if (i == 10) {
|
||||
} else if (opcode == 10) {
|
||||
unusedInt = buffer.read16U();
|
||||
} else if (i == 11) {
|
||||
} else if (opcode == 11) {
|
||||
stackable = true;
|
||||
} else if (i == 12) {
|
||||
} else if (opcode == 12) {
|
||||
cost = buffer.read32();
|
||||
} else if (i == 16) {
|
||||
} else if (opcode == 16) {
|
||||
members = true;
|
||||
} else if (i == 23) {
|
||||
maleModelId0 = buffer.read16U();
|
||||
} else if (opcode == 23) {
|
||||
maleModelID0 = buffer.read16U();
|
||||
maleOffsetY = buffer.read();
|
||||
} else if (i == 24) {
|
||||
maleModelId1 = buffer.read16U();
|
||||
} else if (i == 25) {
|
||||
femaleModelId0 = buffer.read16U();
|
||||
} else if (opcode == 24) {
|
||||
maleModelID1 = buffer.read16U();
|
||||
} else if (opcode == 25) {
|
||||
femaleModelID0 = buffer.read16U();
|
||||
femaleOffsetY = buffer.read();
|
||||
} else if (i == 26) {
|
||||
femaleModelId1 = buffer.read16U();
|
||||
} else if ((i >= 30) && (i < 35)) {
|
||||
if (groundOptions == null) {
|
||||
groundOptions = new String[5];
|
||||
} else if (opcode == 26) {
|
||||
femaleModelID1 = buffer.read16U();
|
||||
} else if ((opcode >= 30) && (opcode < 35)) {
|
||||
if (options == null) {
|
||||
options = new String[5];
|
||||
}
|
||||
groundOptions[i - 30] = buffer.readString();
|
||||
if (groundOptions[i - 30].equalsIgnoreCase("hidden")) {
|
||||
groundOptions[i - 30] = null;
|
||||
|
||||
options[opcode - 30] = buffer.readString();
|
||||
|
||||
if (options[opcode - 30].equalsIgnoreCase("hidden")) {
|
||||
options[opcode - 30] = null;
|
||||
}
|
||||
} else if ((i >= 35) && (i < 40)) {
|
||||
} else if ((opcode >= 35) && (opcode < 40)) {
|
||||
if (inventoryOptions == null) {
|
||||
inventoryOptions = new String[5];
|
||||
}
|
||||
inventoryOptions[i - 35] = buffer.readString();
|
||||
} else if (i == 40) {
|
||||
int j = buffer.read8U();
|
||||
srcColor = new int[j];
|
||||
dstColor = new int[j];
|
||||
for (int k = 0; k < j; k++) {
|
||||
srcColor[k] = buffer.read16U();
|
||||
dstColor[k] = buffer.read16U();
|
||||
inventoryOptions[opcode - 35] = buffer.readString();
|
||||
} else if (opcode == 40) {
|
||||
int recolorCount = buffer.read8U();
|
||||
srcColor = new int[recolorCount];
|
||||
dstColor = new int[recolorCount];
|
||||
for (int i = 0; i < recolorCount; i++) {
|
||||
srcColor[i] = buffer.read16U();
|
||||
dstColor[i] = buffer.read16U();
|
||||
}
|
||||
} else if (i == 78) {
|
||||
maleModelId2 = buffer.read16U();
|
||||
} else if (i == 79) {
|
||||
femaleModelId2 = buffer.read16U();
|
||||
} else if (i == 90) {
|
||||
maleHeadModelId0 = buffer.read16U();
|
||||
} else if (i == 91) {
|
||||
femaleHeadModel0 = buffer.read16U();
|
||||
} else if (i == 92) {
|
||||
maleHeadModelId1 = buffer.read16U();
|
||||
} else if (i == 93) {
|
||||
femaleHeadModel1 = buffer.read16U();
|
||||
} else if (i == 95) {
|
||||
} else if (opcode == 78) {
|
||||
maleModelID2 = buffer.read16U();
|
||||
} else if (opcode == 79) {
|
||||
femaleModelID2 = buffer.read16U();
|
||||
} else if (opcode == 90) {
|
||||
maleHeadModelID0 = buffer.read16U();
|
||||
} else if (opcode == 91) {
|
||||
femaleHeadModelID0 = buffer.read16U();
|
||||
} else if (opcode == 92) {
|
||||
maleHeadModelID1 = buffer.read16U();
|
||||
} else if (opcode == 93) {
|
||||
femaleHeadModelID1 = buffer.read16U();
|
||||
} else if (opcode == 95) {
|
||||
iconRoll = buffer.read16U();
|
||||
} else if (i == 97) {
|
||||
} else if (opcode == 97) {
|
||||
linkedID = buffer.read16U();
|
||||
} else if (i == 98) {
|
||||
} else if (opcode == 98) {
|
||||
certificateID = buffer.read16U();
|
||||
} else if ((i >= 100) && (i < 110)) {
|
||||
if (stackIDs == null) {
|
||||
stackIDs = new int[10];
|
||||
stackAmount = new int[10];
|
||||
} else if ((opcode >= 100) && (opcode < 110)) {
|
||||
if (stackID == null) {
|
||||
stackID = new int[10];
|
||||
stackCount = new int[10];
|
||||
}
|
||||
stackIDs[i - 100] = buffer.read16U();
|
||||
stackAmount[i - 100] = buffer.read16U();
|
||||
} else if (i == 110) {
|
||||
stackID[opcode - 100] = buffer.read16U();
|
||||
stackCount[opcode - 100] = buffer.read16U();
|
||||
} else if (opcode == 110) {
|
||||
scaleX = buffer.read16U();
|
||||
} else if (i == 111) {
|
||||
} else if (opcode == 111) {
|
||||
scaleZ = buffer.read16U();
|
||||
} else if (i == 112) {
|
||||
} else if (opcode == 112) {
|
||||
scaleY = buffer.read16U();
|
||||
} else if (i == 113) {
|
||||
} else if (opcode == 113) {
|
||||
lightAmbient = buffer.read();
|
||||
} else if (i == 114) {
|
||||
} else if (opcode == 114) {
|
||||
lightAttenuation = buffer.read() * 5;
|
||||
} else if (i == 115) {
|
||||
} else if (opcode == 115) {
|
||||
team = buffer.read8U();
|
||||
}
|
||||
} while (true);
|
||||
|
||||
@@ -471,7 +471,7 @@ public class OnDemand implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void method560(int file, int store) {
|
||||
public void prefetch(int file, int store) {
|
||||
if (game.filestores[0] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PathingEntity extends Entity {
|
||||
public int targetTileZ;
|
||||
public int size = 1;
|
||||
/**
|
||||
* Passed to {@link Scene#pushTemporary(Entity, int, int, int, int, int, int, boolean, int)} to provide an additional
|
||||
* Passed to {@link Scene#addTemporary(Entity, int, int, int, int, int, int, boolean, int)} to provide an additional
|
||||
* tile worth of draw padding ahead of this entity for things like animations that extend past the normal boundary.
|
||||
*/
|
||||
public boolean needsForwardDrawPadding = false;
|
||||
|
||||
@@ -10,7 +10,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
public final int[] colors = new int[5];
|
||||
public final int[] appearances = new int[12];
|
||||
public long modelUID = -1L;
|
||||
public NPCType npcType;
|
||||
public NPCType transmogrify;
|
||||
public boolean lowmem = false;
|
||||
public int team;
|
||||
public int gender;
|
||||
@@ -79,34 +79,34 @@ public class PlayerEntity extends PathingEntity {
|
||||
}
|
||||
|
||||
if ((Game.loopCycle >= locStartCycle) && (Game.loopCycle < locStopCycle)) {
|
||||
Model model1 = this.locModel;
|
||||
model1.translate(locOffsetX - super.x, locOffsetY - y, locOffsetZ - super.z);
|
||||
Model locModel = this.locModel;
|
||||
locModel.translate(locOffsetX - super.x, locOffsetY - y, locOffsetZ - super.z);
|
||||
|
||||
if (super.dstYaw == 512) {
|
||||
model1.rotateY90();
|
||||
model1.rotateY90();
|
||||
model1.rotateY90();
|
||||
locModel.rotateY90();
|
||||
locModel.rotateY90();
|
||||
locModel.rotateY90();
|
||||
} else if (super.dstYaw == 1024) {
|
||||
model1.rotateY90();
|
||||
model1.rotateY90();
|
||||
locModel.rotateY90();
|
||||
locModel.rotateY90();
|
||||
} else if (super.dstYaw == 1536) {
|
||||
model1.rotateY90();
|
||||
locModel.rotateY90();
|
||||
}
|
||||
|
||||
model = new Model(2, -819, new Model[]{model, model1});
|
||||
model = new Model(2, -819, new Model[]{model, locModel});
|
||||
|
||||
if (super.dstYaw == 512) {
|
||||
model1.rotateY90();
|
||||
locModel.rotateY90();
|
||||
} else if (super.dstYaw == 1024) {
|
||||
model1.rotateY90();
|
||||
model1.rotateY90();
|
||||
locModel.rotateY90();
|
||||
locModel.rotateY90();
|
||||
} else if (super.dstYaw == 1536) {
|
||||
model1.rotateY90();
|
||||
model1.rotateY90();
|
||||
model1.rotateY90();
|
||||
locModel.rotateY90();
|
||||
locModel.rotateY90();
|
||||
locModel.rotateY90();
|
||||
}
|
||||
|
||||
model1.translate(super.x - locOffsetX, y - locOffsetY, super.z - locOffsetZ);
|
||||
locModel.translate(super.x - locOffsetX, y - locOffsetY, super.z - locOffsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
buffer.position = 0;
|
||||
gender = buffer.read8U();
|
||||
headicons = buffer.read8U();
|
||||
npcType = null;
|
||||
transmogrify = null;
|
||||
team = 0;
|
||||
|
||||
for (int part = 0; part < 12; part++) {
|
||||
@@ -133,7 +133,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
appearances[part] = (msb << 8) + lsb;
|
||||
|
||||
if ((part == 0) && (appearances[0] == 65535)) {
|
||||
npcType = NPCType.get(buffer.read16U());
|
||||
transmogrify = NPCType.get(buffer.read16U());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -216,14 +216,14 @@ public class PlayerEntity extends PathingEntity {
|
||||
}
|
||||
|
||||
public Model getSequencedModel() {
|
||||
if (npcType != null) {
|
||||
if (transmogrify != null) {
|
||||
int transformID = -1;
|
||||
if ((super.primarySeqID >= 0) && (super.primarySeqDelay == 0)) {
|
||||
transformID = SeqType.instances[super.primarySeqID].transformIDs[super.primarySeqFrame];
|
||||
} else if (super.secondarySeqID >= 0) {
|
||||
transformID = SeqType.instances[super.secondarySeqID].transformIDs[super.secondarySeqFrame];
|
||||
}
|
||||
return npcType.getSequencedModel(-1, transformID, null);
|
||||
return transmogrify.getSequencedModel(-1, transformID, null);
|
||||
}
|
||||
|
||||
long hashCode = this.appearanceHashcode;
|
||||
@@ -338,19 +338,19 @@ public class PlayerEntity extends PathingEntity {
|
||||
return model;
|
||||
}
|
||||
|
||||
Model animated = Model.EMPTY;
|
||||
animated.set(model, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID));
|
||||
Model tmp = Model.EMPTY;
|
||||
tmp.set(model, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID));
|
||||
|
||||
if ((primaryTransformID != -1) && (secondaryTransformID != -1)) {
|
||||
animated.applyTransforms(primaryTransformID, secondaryTransformID, SeqType.instances[super.primarySeqID].mask);
|
||||
tmp.applyTransforms(primaryTransformID, secondaryTransformID, SeqType.instances[super.primarySeqID].mask);
|
||||
} else if (primaryTransformID != -1) {
|
||||
animated.applyTransform(primaryTransformID);
|
||||
tmp.applyTransform(primaryTransformID);
|
||||
}
|
||||
|
||||
animated.calculateBoundsCylinder();
|
||||
animated.labelFaces = null;
|
||||
animated.labelVertices = null;
|
||||
return animated;
|
||||
tmp.calculateBoundsCylinder();
|
||||
tmp.labelFaces = null;
|
||||
tmp.labelVertices = null;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -363,8 +363,8 @@ public class PlayerEntity extends PathingEntity {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (npcType != null) {
|
||||
return npcType.getUnlitHeadModel();
|
||||
if (transmogrify != null) {
|
||||
return transmogrify.getUnlitHeadModel();
|
||||
}
|
||||
|
||||
boolean invalid = false;
|
||||
@@ -403,15 +403,18 @@ public class PlayerEntity extends PathingEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Model model = new Model(modelCount, models);
|
||||
for (int j1 = 0; j1 < 5; j1++) {
|
||||
if (colors[j1] != 0) {
|
||||
model.recolor(Game.designPartColor[j1][0], Game.designPartColor[j1][colors[j1]]);
|
||||
if (j1 == 1) {
|
||||
model.recolor(Game.designHairColor[0], Game.designHairColor[colors[j1]]);
|
||||
|
||||
for (int part = 0; part < 5; part++) {
|
||||
if (colors[part] != 0) {
|
||||
model.recolor(Game.designPartColor[part][0], Game.designPartColor[part][colors[part]]);
|
||||
if (part == 1) {
|
||||
model.recolor(Game.designHairColor[0], Game.designHairColor[colors[part]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -490,17 +490,17 @@ public class Scene {
|
||||
levelTiles[level][tileX][tileZ].wallDecoration = deco;
|
||||
}
|
||||
|
||||
public boolean push(Entity entity, int level, int tileX, int tileZ, int y, int width, int length, int yaw, int bitset, byte info) {
|
||||
public boolean add(Entity entity, int level, int tileX, int tileZ, int y, int width, int length, int yaw, int bitset, byte info) {
|
||||
if (entity == null) {
|
||||
return true;
|
||||
} else {
|
||||
int sceneX = (tileX * 128) + (64 * width);
|
||||
int sceneZ = (tileZ * 128) + (64 * length);
|
||||
return push(entity, level, tileX, tileZ, width, length, sceneX, sceneZ, y, yaw, bitset, info, false);
|
||||
return add(entity, level, tileX, tileZ, width, length, sceneX, sceneZ, y, yaw, bitset, info, false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean pushTemporary(Entity entity, int level, int x, int z, int y, int yaw, int bitset, boolean forwardPadding, int padding) {
|
||||
public boolean addTemporary(Entity entity, int level, int x, int z, int y, int yaw, int bitset, boolean forwardPadding, int padding) {
|
||||
if (entity == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -529,18 +529,18 @@ public class Scene {
|
||||
z0 /= 128;
|
||||
x1 /= 128;
|
||||
z1 /= 128;
|
||||
return push(entity, level, x0, z0, (x1 - x0) + 1, (z1 - z0) + 1, x, z, y, yaw, bitset, (byte) 0, true);
|
||||
return add(entity, level, x0, z0, (x1 - x0) + 1, (z1 - z0) + 1, x, z, y, yaw, bitset, (byte) 0, true);
|
||||
}
|
||||
|
||||
public boolean pushTemporary(Entity entity, int level, int minTileX, int minTileZ, int maxTileX, int maxTileZ, int x, int z, int y, int yaw, int bitset) {
|
||||
public boolean addTemporary(Entity entity, int level, int minTileX, int minTileZ, int maxTileX, int maxTileZ, int x, int z, int y, int yaw, int bitset) {
|
||||
if (entity == null) {
|
||||
return true;
|
||||
} else {
|
||||
return push(entity, level, minTileX, minTileZ, (maxTileX - minTileX) + 1, (maxTileZ - minTileZ) + 1, x, z, y, yaw, bitset, (byte) 0, true);
|
||||
return add(entity, level, minTileX, minTileZ, (maxTileX - minTileX) + 1, (maxTileZ - minTileZ) + 1, x, z, y, yaw, bitset, (byte) 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean push(Entity entity, int level, int tileX, int tileZ, int tileSizeX, int tileSizeZ, int x, int z, int y, int yaw, int bitset, byte info, boolean temporary) {
|
||||
public boolean add(Entity entity, int level, int tileX, int tileZ, int tileSizeX, int tileSizeZ, int x, int z, int y, int yaw, int bitset, byte info, boolean temporary) {
|
||||
for (int tx = tileX; tx < (tileX + tileSizeX); tx++) {
|
||||
for (int tz = tileZ; tz < (tileZ + tileSizeZ); tz++) {
|
||||
if ((tx < 0) || (tz < 0) || (tx >= maxTileX) || (tz >= maxTileZ)) {
|
||||
@@ -2079,7 +2079,7 @@ public class Scene {
|
||||
for (int i = 0; i < count; i++) {
|
||||
SceneOccluder occluder = occluders[i];
|
||||
|
||||
if (occluder.type == 1) {
|
||||
if (occluder.type == SceneOccluder.TYPE_WALL_X) {
|
||||
int x = (occluder.minTileX - eyeTileX) + 25;
|
||||
|
||||
if ((x < 0) || (x > 50)) {
|
||||
@@ -2134,7 +2134,7 @@ public class Scene {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (occluder.type == 2) {
|
||||
if (occluder.type == SceneOccluder.TYPE_WALL_Z) {
|
||||
int distanceMinTileZ = (occluder.minTileZ - eyeTileZ) + 25;
|
||||
|
||||
if ((distanceMinTileZ < 0) || (distanceMinTileZ > 50)) {
|
||||
@@ -2184,7 +2184,7 @@ public class Scene {
|
||||
occluder.maxDeltaY = ((occluder.maxY - eyeY) << 10) / deltaMinZ;
|
||||
activeOccluders[activeOccluderCount++] = occluder;
|
||||
activeWallOccluderCount++;
|
||||
} else if (occluder.type == 4) {
|
||||
} else if (occluder.type == SceneOccluder.TYPE_GROUND) {
|
||||
int deltaMaxY = occluder.minY - eyeY;
|
||||
|
||||
if (deltaMaxY <= 128) {
|
||||
|
||||
+471
-424
File diff suppressed because it is too large.
Load diff
@@ -1,523 +0,0 @@
|
||||
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
public class SceneCollisionMap {
|
||||
|
||||
public final int anInt290 = 0;
|
||||
public final int anInt291 = 0;
|
||||
public final int anInt292;
|
||||
public final int anInt293;
|
||||
public final int[][] flags;
|
||||
|
||||
public SceneCollisionMap(int i, int j) {
|
||||
anInt292 = i;
|
||||
anInt293 = j;
|
||||
flags = new int[anInt292][anInt293];
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
for (int i = 0; i < anInt292; i++) {
|
||||
for (int j = 0; j < anInt293; j++) {
|
||||
if ((i == 0) || (j == 0) || (i == (anInt292 - 1)) || (j == (anInt293 - 1))) {
|
||||
flags[i][j] = 0xffffff;
|
||||
} else {
|
||||
flags[i][j] = 0x1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 (rotation == 1) {
|
||||
add(k, i, 2);
|
||||
add(k, i + 1, 32);
|
||||
}
|
||||
if (rotation == 2) {
|
||||
add(k, i, 8);
|
||||
add(k + 1, i, 128);
|
||||
}
|
||||
if (rotation == 3) {
|
||||
add(k, i, 32);
|
||||
add(k, i - 1, 2);
|
||||
}
|
||||
}
|
||||
if ((kind == 1) || (kind == 3)) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 1);
|
||||
add(k - 1, i + 1, 16);
|
||||
}
|
||||
if (rotation == 1) {
|
||||
add(k, i, 4);
|
||||
add(k + 1, i + 1, 64);
|
||||
}
|
||||
if (rotation == 2) {
|
||||
add(k, i, 16);
|
||||
add(k + 1, i - 1, 1);
|
||||
}
|
||||
if (rotation == 3) {
|
||||
add(k, i, 64);
|
||||
add(k - 1, i - 1, 4);
|
||||
}
|
||||
}
|
||||
if (kind == 2) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 130);
|
||||
add(k - 1, i, 8);
|
||||
add(k, i + 1, 32);
|
||||
}
|
||||
if (rotation == 1) {
|
||||
add(k, i, 10);
|
||||
add(k, i + 1, 32);
|
||||
add(k + 1, i, 128);
|
||||
}
|
||||
if (rotation == 2) {
|
||||
add(k, i, 40);
|
||||
add(k + 1, i, 128);
|
||||
add(k, i - 1, 2);
|
||||
}
|
||||
if (rotation == 3) {
|
||||
add(k, i, 160);
|
||||
add(k, i - 1, 2);
|
||||
add(k - 1, i, 8);
|
||||
}
|
||||
}
|
||||
if (blocksProjectiles) {
|
||||
if (kind == 0) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 0x10000);
|
||||
add(k - 1, i, 4096);
|
||||
}
|
||||
if (rotation == 1) {
|
||||
add(k, i, 1024);
|
||||
add(k, i + 1, 16384);
|
||||
}
|
||||
if (rotation == 2) {
|
||||
add(k, i, 4096);
|
||||
add(k + 1, i, 0x10000);
|
||||
}
|
||||
if (rotation == 3) {
|
||||
add(k, i, 16384);
|
||||
add(k, i - 1, 1024);
|
||||
}
|
||||
}
|
||||
if ((kind == 1) || (kind == 3)) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 512);
|
||||
add(k - 1, i + 1, 8192);
|
||||
}
|
||||
if (rotation == 1) {
|
||||
add(k, i, 2048);
|
||||
add(k + 1, i + 1, 32768);
|
||||
}
|
||||
if (rotation == 2) {
|
||||
add(k, i, 8192);
|
||||
add(k + 1, i - 1, 512);
|
||||
}
|
||||
if (rotation == 3) {
|
||||
add(k, i, 32768);
|
||||
add(k - 1, i - 1, 2048);
|
||||
}
|
||||
}
|
||||
if (kind == 2) {
|
||||
if (rotation == 0) {
|
||||
add(k, i, 0x10400);
|
||||
add(k - 1, i, 4096);
|
||||
add(k, i + 1, 16384);
|
||||
}
|
||||
if (rotation == 1) {
|
||||
add(k, i, 5120);
|
||||
add(k, i + 1, 16384);
|
||||
add(k + 1, i, 0x10000);
|
||||
}
|
||||
if (rotation == 2) {
|
||||
add(k, i, 20480);
|
||||
add(k + 1, i, 0x10000);
|
||||
add(k, i - 1, 1024);
|
||||
}
|
||||
if (rotation == 3) {
|
||||
add(k, i, 0x14000);
|
||||
add(k, i - 1, 1024);
|
||||
add(k - 1, i, 4096);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void add(boolean blocksProjectiles, int width, int length, int x, int z, int rotation) {
|
||||
int flags = 256;
|
||||
|
||||
if (blocksProjectiles) {
|
||||
flags += 0x20000;
|
||||
}
|
||||
|
||||
if ((rotation == 1) || (rotation == 3)) {
|
||||
int tmp = width;
|
||||
width = length;
|
||||
length = tmp;
|
||||
}
|
||||
|
||||
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 addSolid(int z, int x) {
|
||||
flags[x][z] |= 0x200000;
|
||||
}
|
||||
|
||||
public void add(int x, int z, int k) {
|
||||
flags[x][z] |= k;
|
||||
}
|
||||
|
||||
public void remove(int i, int j, boolean flag, int k, int l) {
|
||||
if (j == 0) {
|
||||
if (i == 0) {
|
||||
method217(128, k, l);
|
||||
method217(8, k - 1, l);
|
||||
}
|
||||
if (i == 1) {
|
||||
method217(2, k, l);
|
||||
method217(32, k, l + 1);
|
||||
}
|
||||
if (i == 2) {
|
||||
method217(8, k, l);
|
||||
method217(128, k + 1, l);
|
||||
}
|
||||
if (i == 3) {
|
||||
method217(32, k, l);
|
||||
method217(2, k, l - 1);
|
||||
}
|
||||
}
|
||||
if ((j == 1) || (j == 3)) {
|
||||
if (i == 0) {
|
||||
method217(1, k, l);
|
||||
method217(16, k - 1, l + 1);
|
||||
}
|
||||
if (i == 1) {
|
||||
method217(4, k, l);
|
||||
method217(64, k + 1, l + 1);
|
||||
}
|
||||
if (i == 2) {
|
||||
method217(16, k, l);
|
||||
method217(1, k + 1, l - 1);
|
||||
}
|
||||
if (i == 3) {
|
||||
method217(64, k, l);
|
||||
method217(4, k - 1, l - 1);
|
||||
}
|
||||
}
|
||||
if (j == 2) {
|
||||
if (i == 0) {
|
||||
method217(130, k, l);
|
||||
method217(8, k - 1, l);
|
||||
method217(32, k, l + 1);
|
||||
}
|
||||
if (i == 1) {
|
||||
method217(10, k, l);
|
||||
method217(32, k, l + 1);
|
||||
method217(128, k + 1, l);
|
||||
}
|
||||
if (i == 2) {
|
||||
method217(40, k, l);
|
||||
method217(128, k + 1, l);
|
||||
method217(2, k, l - 1);
|
||||
}
|
||||
if (i == 3) {
|
||||
method217(160, k, l);
|
||||
method217(2, k, l - 1);
|
||||
method217(8, k - 1, l);
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (j == 0) {
|
||||
if (i == 0) {
|
||||
method217(0x10000, k, l);
|
||||
method217(4096, k - 1, l);
|
||||
}
|
||||
if (i == 1) {
|
||||
method217(1024, k, l);
|
||||
method217(16384, k, l + 1);
|
||||
}
|
||||
if (i == 2) {
|
||||
method217(4096, k, l);
|
||||
method217(0x10000, k + 1, l);
|
||||
}
|
||||
if (i == 3) {
|
||||
method217(16384, k, l);
|
||||
method217(1024, k, l - 1);
|
||||
}
|
||||
}
|
||||
if ((j == 1) || (j == 3)) {
|
||||
if (i == 0) {
|
||||
method217(512, k, l);
|
||||
method217(8192, k - 1, l + 1);
|
||||
}
|
||||
if (i == 1) {
|
||||
method217(2048, k, l);
|
||||
method217(32768, k + 1, l + 1);
|
||||
}
|
||||
if (i == 2) {
|
||||
method217(8192, k, l);
|
||||
method217(512, k + 1, l - 1);
|
||||
}
|
||||
if (i == 3) {
|
||||
method217(32768, k, l);
|
||||
method217(2048, k - 1, l - 1);
|
||||
}
|
||||
}
|
||||
if (j == 2) {
|
||||
if (i == 0) {
|
||||
method217(0x10400, k, l);
|
||||
method217(4096, k - 1, l);
|
||||
method217(16384, k, l + 1);
|
||||
}
|
||||
if (i == 1) {
|
||||
method217(5120, k, l);
|
||||
method217(16384, k, l + 1);
|
||||
method217(0x10000, k + 1, l);
|
||||
}
|
||||
if (i == 2) {
|
||||
method217(20480, k, l);
|
||||
method217(0x10000, k + 1, l);
|
||||
method217(1024, k, l - 1);
|
||||
}
|
||||
if (i == 3) {
|
||||
method217(0x14000, k, l);
|
||||
method217(1024, k, l - 1);
|
||||
method217(4096, k - 1, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(int rotation, int width, int x0, int z0, int length, boolean flag) {
|
||||
int flags = 256;
|
||||
if (flag) {
|
||||
flags += 0x20000;
|
||||
}
|
||||
if ((rotation == 1) || (rotation == 3)) {
|
||||
int tmp = width;
|
||||
width = length;
|
||||
length = tmp;
|
||||
}
|
||||
for (int x = x0; x < (x0 + width); x++) {
|
||||
if ((x >= 0) && (x < anInt292)) {
|
||||
for (int z = z0; z < (z0 + length); z++) {
|
||||
if ((z >= 0) && (z < anInt293)) {
|
||||
method217(flags, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void method217(int flag, int x, int z) {
|
||||
flags[x][z] &= 0xffffff - flag;
|
||||
}
|
||||
|
||||
public void method218(int j, int k) {
|
||||
flags[k][j] &= 0xdfffff;
|
||||
}
|
||||
|
||||
public boolean method219(int sx, int sz, int dx, int dz, int locAngle, int locType) {
|
||||
if ((sx == dx) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if (locType == 0) {
|
||||
if (locAngle == 0) {
|
||||
if ((sx == (dx - 1)) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 1) {
|
||||
if ((sx == dx) && (sz == (dz + 1))) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 2) {
|
||||
if ((sx == (dx + 1)) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 3) {
|
||||
if ((sx == dx) && (sz == (dz - 1))) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (locType == 2) {
|
||||
if (locAngle == 0) {
|
||||
if ((sx == (dx - 1)) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1))) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 1) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1))) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx + 1)) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 0x1280102) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 2) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280108) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx + 1)) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1))) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 3) {
|
||||
if ((sx == (dx - 1)) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x1280120) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x1280180) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (locType == 9) {
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x20) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 2) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 8) == 0)) {
|
||||
return true;
|
||||
}
|
||||
return (sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x80) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean method220(int sx, int sz, int dx, int dz, int locType, int locAngle) {
|
||||
if ((sx == dx) && (sz == dz)) {
|
||||
return true;
|
||||
}
|
||||
if ((locType == 6) || (locType == 7)) {
|
||||
if (locType == 7) {
|
||||
locAngle = (locAngle + 2) & 3;
|
||||
}
|
||||
if (locAngle == 0) {
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x80) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 2) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 1) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 8) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 2) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 2) {
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 8) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x20) == 0)) {
|
||||
return true;
|
||||
}
|
||||
} else if (locAngle == 3) {
|
||||
if ((sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x80) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x20) == 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (locType == 8) {
|
||||
if ((sx == dx) && (sz == (dz + 1)) && ((flags[sx][sz] & 0x20) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == dx) && (sz == (dz - 1)) && ((flags[sx][sz] & 2) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((sx == (dx - 1)) && (sz == dz) && ((flags[sx][sz] & 8) == 0)) {
|
||||
return true;
|
||||
}
|
||||
return (sx == (dx + 1)) && (sz == dz) && ((flags[sx][sz] & 0x80) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean method221(int x, int z, int dx, int dz, int locWidth, int locLength, int locInteractionFlags) {
|
||||
int x1 = (dx + locWidth) - 1;
|
||||
int z1 = (dz + locLength) - 1;
|
||||
if ((x >= dx) && (x <= x1) && (z >= dz) && (z <= z1)) {
|
||||
return true;
|
||||
}
|
||||
if ((x == (dx - 1)) && (z >= dz) && (z <= z1) && ((this.flags[x - anInt290][z - anInt291] & 8) == 0) && ((locInteractionFlags & 8) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((x == (x1 + 1)) && (z >= dz) && (z <= z1) && ((this.flags[x - anInt290][z - anInt291] & 0x80) == 0) && ((locInteractionFlags & 2) == 0)) {
|
||||
return true;
|
||||
}
|
||||
if ((z == (dz - 1)) && (x >= dx) && (x <= x1) && ((this.flags[x - anInt290][z - anInt291] & 2) == 0) && ((locInteractionFlags & 4) == 0)) {
|
||||
return true;
|
||||
}
|
||||
return (z == (z1 + 1)) && (x >= dx) && (x <= x1) && ((this.flags[x - anInt290][z - anInt291] & 0x20) == 0) && ((locInteractionFlags & 1) == 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,19 @@
|
||||
|
||||
public class SceneOccluder {
|
||||
|
||||
/**
|
||||
* A wall occluder which runs along the X axis.
|
||||
*/
|
||||
public static final int TYPE_WALL_X = 1;
|
||||
/**
|
||||
* A wall occluder which runs along the Z axis.
|
||||
*/
|
||||
public static final int TYPE_WALL_Z = 2;
|
||||
/**
|
||||
* A ground occluder which covers the XZ plane.
|
||||
*/
|
||||
public static final int TYPE_GROUND = 4;
|
||||
|
||||
public int minTileX;
|
||||
public int maxTileX;
|
||||
public int minTileZ;
|
||||
|
||||
+16
-16
@@ -58,7 +58,7 @@ public class SeqType {
|
||||
|
||||
/**
|
||||
* Adds additional space to the render bounds.
|
||||
* @see Scene#pushTemporary(Entity, int, int, int, int, int, int, boolean, int)
|
||||
* @see Scene#addTemporary(Entity, int, int, int, int, int, int, boolean, int)
|
||||
*/
|
||||
public boolean forwardRenderPadding = false;
|
||||
|
||||
@@ -131,10 +131,10 @@ public class SeqType {
|
||||
|
||||
public void load(Buffer buffer) {
|
||||
do {
|
||||
int op = buffer.read8U();
|
||||
if (op == 0) {
|
||||
int opcode = buffer.read8U();
|
||||
if (opcode == 0) {
|
||||
break;
|
||||
} else if (op == 1) {
|
||||
} else if (opcode == 1) {
|
||||
frameCount = buffer.read8U();
|
||||
transformIDs = new int[frameCount];
|
||||
auxiliaryTransformIDs = new int[frameCount];
|
||||
@@ -147,35 +147,35 @@ public class SeqType {
|
||||
}
|
||||
frameDuration[f] = buffer.read16U();
|
||||
}
|
||||
} else if (op == 2) {
|
||||
} else if (opcode == 2) {
|
||||
loopFrameCount = buffer.read16U();
|
||||
} else if (op == 3) {
|
||||
} else if (opcode == 3) {
|
||||
int count = buffer.read8U();
|
||||
mask = new int[count + 1];
|
||||
for (int l = 0; l < count; l++) {
|
||||
mask[l] = buffer.read8U();
|
||||
}
|
||||
mask[count] = 9999999;
|
||||
} else if (op == 4) {
|
||||
} else if (opcode == 4) {
|
||||
forwardRenderPadding = true;
|
||||
} else if (op == 5) {
|
||||
} else if (opcode == 5) {
|
||||
priority = buffer.read8U();
|
||||
} else if (op == 6) {
|
||||
} else if (opcode == 6) {
|
||||
rightHandOverride = buffer.read16U();
|
||||
} else if (op == 7) {
|
||||
} else if (opcode == 7) {
|
||||
leftHandOverride = buffer.read16U();
|
||||
} else if (op == 8) {
|
||||
} else if (opcode == 8) {
|
||||
loopCount = buffer.read8U();
|
||||
} else if (op == 9) {
|
||||
} else if (opcode == 9) {
|
||||
moveStyle = buffer.read8U();
|
||||
} else if (op == 10) {
|
||||
} else if (opcode == 10) {
|
||||
idleStyle = buffer.read8U();
|
||||
} else if (op == 11) {
|
||||
} else if (opcode == 11) {
|
||||
replayStyle = buffer.read8U();
|
||||
} else if (op == 12) {
|
||||
} else if (opcode == 12) {
|
||||
unusedInt = buffer.read32();
|
||||
} else {
|
||||
System.out.println("Error unrecognised seq config code: " + op);
|
||||
System.out.println("Error unrecognised seq config code: " + opcode);
|
||||
}
|
||||
} while (true);
|
||||
|
||||
|
||||
@@ -49,23 +49,23 @@ public class VarbitType {
|
||||
|
||||
public void read(Buffer buffer) {
|
||||
do {
|
||||
int op = buffer.read8U();
|
||||
if (op == 0) {
|
||||
int opcode = buffer.read8U();
|
||||
if (opcode == 0) {
|
||||
return;
|
||||
} else if (op == 1) {
|
||||
} else if (opcode == 1) {
|
||||
varp = buffer.read16U();
|
||||
lsb = buffer.read8U();
|
||||
msb = buffer.read8U();
|
||||
} else if (op == 10) {
|
||||
} else if (opcode == 10) {
|
||||
unusedString = buffer.readString();
|
||||
} else if (op == 2) {
|
||||
} else if (opcode == 2) {
|
||||
unusedBool = true;
|
||||
} else if (op == 3) {
|
||||
} else if (opcode == 3) {
|
||||
unusedInt0 = buffer.read32();
|
||||
} else if (op == 4) {
|
||||
} else if (opcode == 4) {
|
||||
unusedInt1 = buffer.read32();
|
||||
} else {
|
||||
System.out.println("Error unrecognised config code: " + op);
|
||||
System.out.println("Error unrecognised config code: " + opcode);
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
+15
-15
@@ -49,37 +49,37 @@ public class VarpType {
|
||||
|
||||
public void read(Buffer buffer, int i) {
|
||||
do {
|
||||
int op = buffer.read8U();
|
||||
if (op == 0) {
|
||||
int opcode = buffer.read8U();
|
||||
if (opcode == 0) {
|
||||
return;
|
||||
} else if (op == 1) {
|
||||
} else if (opcode == 1) {
|
||||
unusedInt0 = buffer.read8U();
|
||||
} else if (op == 2) {
|
||||
} else if (opcode == 2) {
|
||||
unusedInt1 = buffer.read8U();
|
||||
} else if (op == 3) {
|
||||
} else if (opcode == 3) {
|
||||
unusedBool0 = true;
|
||||
anIntArray703[anInt702++] = i;
|
||||
} else if (op == 4) {
|
||||
} else if (opcode == 4) {
|
||||
unusedBool1 = false;
|
||||
} else if (op == 5) {
|
||||
} else if (opcode == 5) {
|
||||
type = buffer.read16U();
|
||||
} else if (op == 6) {
|
||||
} else if (opcode == 6) {
|
||||
unusedBool2 = true;
|
||||
} else if (op == 7) {
|
||||
} else if (opcode == 7) {
|
||||
unusedInt2 = buffer.read32();
|
||||
} else if (op == 8) {
|
||||
} else if (opcode == 8) {
|
||||
unusedInt3 = 1;
|
||||
unusedBool3 = true;
|
||||
} else if (op == 10) {
|
||||
} else if (opcode == 10) {
|
||||
unusedString = buffer.readString();
|
||||
} else if (op == 11) {
|
||||
} else if (opcode == 11) {
|
||||
unusedBool3 = true;
|
||||
} else if (op == 12) {
|
||||
} else if (opcode == 12) {
|
||||
unusedInt4 = buffer.read32();
|
||||
} else if (op == 13) {
|
||||
} else if (opcode == 13) {
|
||||
unusedInt3 = 2;
|
||||
} else {
|
||||
System.out.println("Error unrecognised config code: " + op);
|
||||
System.out.println("Error unrecognised config code: " + opcode);
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user