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:
jason@long.name 2013-07-17 20:59:06 +00:00
parent a4f8846ca7
commit 000036c303
9 changed files with 34 additions and 31 deletions

View file

@ -647,16 +647,16 @@
638 ind_zones@32,128
639 ind_zones@0,144
640 ind_zones@16,144
641 ind_zones@32,144 (becomes=884)
641 ind_zones@32,144
642 ind_zones@0,160
643 ind_zones@16,160
644 ind_zones@32,160 (becomes=888)
644 ind_zones@32,160
645 ind_zones@0,176
646 ind_zones@16,176
647 ind_zones@32,176
648 ind_zones@0,192
649 ind_zones@16,192 (becomes=892)
650 ind_zones@32,192 (becomes=896)
649 ind_zones@16,192
650 ind_zones@32,192
651 ind_zones@0,208
652 ind_zones@16,208
653 ind_zones@32,208
@ -682,8 +682,8 @@
673 ind_zones@16,320
674 ind_zones@32,320
675 ind_zones@0,336
676 ind_zones@16,336 (becomes=900)
677 ind_zones@32,336 (becomes=904)
676 ind_zones@16,336
677 ind_zones@32,336
678 ind_zones@0,352
679 ind_zones@16,352
680 ind_zones@32,352
@ -692,10 +692,10 @@
683 ind_zones@32,368
684 ind_zones@0,384
685 ind_zones@16,384
686 ind_zones@32,384 (becomes=908)
686 ind_zones@32,384
687 ind_zones@0,400
688 ind_zones@16,400
689 ind_zones@32,400 (becomes=912)
689 ind_zones@32,400
690 ind_zones@0,416
691 ind_zones@16,416
692 ind_zones@32,416
@ -719,7 +719,7 @@
# BEGIN AIRPORT #
709 airport@0,0
710 airport@16,0
711 airport@32,0 (becomes=832)
711 airport@32,0
712 airport@48,0
713 airport@64,0
714 airport@80,0
@ -978,6 +978,7 @@
953 misc_animation@0,2016 (becomes=954)
954 misc_animation@0,2032 (becomes=955)
955 misc_animation@0,2048 (becomes=952)
# unused #
956 misc_animation@0,2064
957 misc_animation@0,2080
958 misc_animation@0,2096

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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)));
}
}

View file

@ -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)
);
}
}

View file

@ -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;
}

View file

@ -193,7 +193,7 @@ public abstract class Sprite
}
else {
city.setTile(xpos, ypos,
(char) (TINYEXP | BULLBIT | ANIMBIT));
(char) (TINYEXP | BULLBIT));
}
}
}

View file

@ -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)
{

View file

@ -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);