9 package micropolisj.engine;
11 import static micropolisj.engine.TileConstants.*;
21 static int [] BDx = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
22 static int [] BDy = { 0, -1, -1, 0, 1, 1, 1, 0, -1 };
23 static int [] BPx = { 0, 0, 2, 2, 2, 0, -2, -2, -2 };
24 static int [] BPy = { 0, -2, -2, 0, 2, 2, 2, 0, -2 };
25 static int [] BtClrTab = { RIVER, CHANNEL, POWERBASE, POWERBASE+1,
26 RAILBASE, RAILBASE+1, BRWH, BRWV };
40 this.
x = xpos * 16 + 8;
41 this.
y = ypos * 16 + 8;
58 if (this.soundCount <= 0) {
59 if (city.PRNG.nextInt(4) == 0) {
62 this.soundCount = 200;
66 if (this.count <= 0) {
68 if (this.newDir != this.
frame) {
72 int tem = city.PRNG.nextInt(8);
74 for (pem = tem; pem < (tem + 8); pem++) {
75 int z = (pem % 8) + 1;
79 int xpos = this.
x / 16 + BDx[z];
80 int ypos = this.
y / 16 + BDy[z];
84 if ((t == CHANNEL) || (t == BRWH) || (t == BRWV) ||
85 tryOther(t, this.dir, z))
90 if (this.dir > 8) { this.dir -= 8; }
96 if (pem == (tem + 8)) {
98 this.newDir = city.PRNG.nextInt(8)+1;
103 if (z == this.newDir) {
109 if (!spriteInBounds()) {
114 boolean found =
false;
115 for (
int z : BtClrTab) {
122 destroyTile(
x/16,
y/16);
126 boolean tryOther(
int tile,
int oldDir,
int newDir)
130 if (newDir != z)
return false;
132 return (tile == POWERBASE || tile == POWERBASE+1 ||
133 tile == RAILBASE || tile == RAILBASE+1);
136 boolean spriteInBounds()