tile animation: cleanup, remove obsolete ANIMBIT constant
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@737 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
a4f8846ca7
commit
000036c303
9 changed files with 34 additions and 31 deletions
|
@ -38,7 +38,7 @@ class Animate
|
|||
static int [] AniTabC = { IND1, 0, IND2, IND4, 0, 0, IND6, IND8 };
|
||||
static int [] AniTabD = { IND1, 0, IND3, IND5, 0, 0, IND7, IND9 };
|
||||
|
||||
static final int ASCBIT = (ANIMBIT | CONDBIT | BURNBIT);
|
||||
static final int ASCBIT = (CONDBIT | BURNBIT);
|
||||
static final int REGBIT = (CONDBIT | BURNBIT);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class Bulldozer extends ToolStroke
|
|||
tile = tile & LOMASK;
|
||||
if (tile != RADTILE && tile != DIRT) {
|
||||
int z = inPreview ? 0 : city.PRNG.nextInt(3);
|
||||
int nTile = (TINYEXP + z) | ANIMBIT | BULLBIT;
|
||||
int nTile = (TINYEXP + z) | BULLBIT;
|
||||
eff.setTile(xx, yy, nTile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,6 @@ public class ExplosionSprite extends Sprite
|
|||
return;
|
||||
if (isZoneCenter(z))
|
||||
return;
|
||||
city.setTile(xpos, ypos, (char)(FIRE + city.PRNG.nextInt(4) + ANIMBIT));
|
||||
city.setTile(xpos, ypos, (char)(FIRE + city.PRNG.nextInt(4)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,10 +158,7 @@ class MapScanner
|
|||
if (tden != newLevel)
|
||||
{
|
||||
int z = (((cchr & LOMASK) - ROADBASE) & 15) + TRAFFIC_DENSITY_TAB[newLevel];
|
||||
z += cchr & (ALLBITS - ANIMBIT);
|
||||
|
||||
if (newLevel != 0)
|
||||
z |= ANIMBIT;
|
||||
z += cchr & ALLBITS;
|
||||
|
||||
city.setTile(xpos, ypos, (char) z);
|
||||
}
|
||||
|
@ -192,7 +189,7 @@ class MapScanner
|
|||
city.makeExplosion(xtem, ytem);
|
||||
}
|
||||
}
|
||||
city.setTile(xtem, ytem, (char)(FIRE + PRNG.nextInt(4) + ANIMBIT));
|
||||
city.setTile(xtem, ytem, (char)(FIRE + PRNG.nextInt(4)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -611,8 +608,8 @@ class MapScanner
|
|||
{
|
||||
if (((city.cityTime + xpos + ypos) % 32) == 0) {
|
||||
drawStadium(FULLSTADIUM);
|
||||
city.setTile(xpos+1,ypos, (char)(FOOTBALLGAME1 | ANIMBIT));
|
||||
city.setTile(xpos+1,ypos+1,(char)(FOOTBALLGAME2 | ANIMBIT));
|
||||
city.setTile(xpos+1,ypos, (char)(FOOTBALLGAME1));
|
||||
city.setTile(xpos+1,ypos+1,(char)(FOOTBALLGAME2));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -634,7 +631,7 @@ class MapScanner
|
|||
{
|
||||
if ((city.map[ypos-1][xpos+1] & LOMASK) == RADAR) {
|
||||
city.setTile(xpos+1,ypos-1, (char)
|
||||
(RADAR + ANIMBIT + CONDBIT + BURNBIT)
|
||||
(RADAR_ANIM + CONDBIT + BURNBIT)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -754,7 +751,7 @@ class MapScanner
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((thCh & ANIMBIT) != 0)
|
||||
if (isAnimated(thCh))
|
||||
continue;
|
||||
|
||||
thCh &= LOMASK;
|
||||
|
@ -1345,7 +1342,7 @@ class MapScanner
|
|||
int tile = city.getTile(xpos+dx[z], ypos+dy[z]) & LOMASK;
|
||||
if (tile >= COALBASE && tile < COALBASE + 4*4) {
|
||||
city.setTile(xpos + dx[z], ypos + dy[z],
|
||||
(char) (SmTb[z] | ANIMBIT | CONDBIT | PWRBIT | BURNBIT)
|
||||
(char) (SmTb[z] | CONDBIT | PWRBIT | BURNBIT)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1801,7 +1801,7 @@ public class Micropolis
|
|||
|
||||
for (int x = xpos - 1; x < xpos + 3; x++) {
|
||||
for (int y = ypos - 1; y < ypos + 3; y++) {
|
||||
setTile(x, y, (char)(FIRE + PRNG.nextInt(4) + ANIMBIT));
|
||||
setTile(x, y, (char)(FIRE + PRNG.nextInt(4)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2160,7 +2160,7 @@ public class Micropolis
|
|||
if (PRNG.nextInt(4) != 0) {
|
||||
setTile(x, y, (char)(RUBBLE + BULLBIT + PRNG.nextInt(4)));
|
||||
} else {
|
||||
setTile(x, y, (char)(FIRE + ANIMBIT + PRNG.nextInt(8)));
|
||||
setTile(x, y, (char)(FIRE + PRNG.nextInt(8)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2173,7 +2173,7 @@ public class Micropolis
|
|||
int t = getTile(x, y);
|
||||
|
||||
if (TileConstants.isArsonable(t)) {
|
||||
setTile(x, y, (char)(FIRE + ANIMBIT + PRNG.nextInt(8)));
|
||||
setTile(x, y, (char)(FIRE + PRNG.nextInt(8)));
|
||||
crashLocation = new CityLocation(x, y);
|
||||
sendMessageAtPic(MicropolisMessage.FIRE_REPORT, x, y);
|
||||
}
|
||||
|
@ -2191,7 +2191,7 @@ public class Micropolis
|
|||
{
|
||||
tile &= LOMASK;
|
||||
if (tile > 21 && tile < LASTZONE) {
|
||||
setTile(x, y, (char)(FIRE + ANIMBIT + PRNG.nextInt(8)));
|
||||
setTile(x, y, (char)(FIRE + PRNG.nextInt(8)));
|
||||
sendMessageAt(MicropolisMessage.FIRE_REPORT, x, y);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ public abstract class Sprite
|
|||
}
|
||||
else {
|
||||
city.setTile(xpos, ypos,
|
||||
(char) (TINYEXP | BULLBIT | ANIMBIT));
|
||||
(char) (TINYEXP | BULLBIT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ public class TileConstants
|
|||
public static final char CONDBIT = 16384; // bit 14 ... can conduct power
|
||||
public static final char BURNBIT = 8192; // bit 13 ... is combustible
|
||||
public static final char BULLBIT = 4096; // bit 12 ... is bulldozable
|
||||
public static final char ANIMBIT = 2048; // bit 11 ... animates
|
||||
// bit 11 ... unused
|
||||
public static final char ZONEBIT = 1024; // bit 10 ... is the special tile for a zone
|
||||
|
||||
public static final char ALLBITS = 64512; // mask for upper 6 bits
|
||||
|
@ -280,6 +280,12 @@ public class TileConstants
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isAnimated(int tile)
|
||||
{
|
||||
TileSpec spec = Tiles.get(tile & LOMASK);
|
||||
return spec.animNext != null;
|
||||
}
|
||||
|
||||
//used by setFire()
|
||||
public static boolean isArsonable(int tile)
|
||||
{
|
||||
|
|
|
@ -183,8 +183,7 @@ public class ToolStroke
|
|||
{
|
||||
eff.setTile(columnNum, rowNum, (char) (
|
||||
tileBase + BNCNBIT +
|
||||
(columnNum == centerColNum && rowNum == centerRowNum ? ZONEBIT : 0) +
|
||||
(width==4 && columnNum==1 && rowNum==2 ? ANIMBIT : 0)
|
||||
(columnNum == centerColNum && rowNum == centerRowNum ? ZONEBIT : 0)
|
||||
));
|
||||
tileBase++;
|
||||
}
|
||||
|
@ -244,7 +243,7 @@ public class ToolStroke
|
|||
if (z < 4) {
|
||||
tile = (WOODS2 + z) | BURNBIT | BULLBIT;
|
||||
} else {
|
||||
tile = FOUNTAIN | BURNBIT | BULLBIT | ANIMBIT;
|
||||
tile = FOUNTAIN | BURNBIT | BULLBIT;
|
||||
}
|
||||
|
||||
eff.spend(cost);
|
||||
|
|
Reference in a new issue