tile animation: make industrial zone smoke animations initiated by tiles.rc
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@760 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
0c497aa434
commit
7540682a06
3 changed files with 49 additions and 150 deletions
|
@ -632,7 +632,7 @@
|
||||||
618 ind_zones@0,32 (conducts)
|
618 ind_zones@0,32 (conducts)
|
||||||
619 ind_zones@16,32 (conducts)
|
619 ind_zones@16,32 (conducts)
|
||||||
620 ind_zones@32,32 (conducts)
|
620 ind_zones@32,32 (conducts)
|
||||||
621 ind_zones@0,48 (conducts)
|
621 ind_zones@0,48 (conducts)(onpower=852)
|
||||||
622 ind_zones@16,48 (conducts)
|
622 ind_zones@16,48 (conducts)
|
||||||
623 ind_zones@32,48 (conducts)
|
623 ind_zones@32,48 (conducts)
|
||||||
624 ind_zones@0,64 (conducts)
|
624 ind_zones@0,64 (conducts)
|
||||||
|
@ -652,16 +652,16 @@
|
||||||
638 ind_zones@32,128 (conducts)
|
638 ind_zones@32,128 (conducts)
|
||||||
639 ind_zones@0,144 (conducts)
|
639 ind_zones@0,144 (conducts)
|
||||||
640 ind_zones@16,144 (conducts)
|
640 ind_zones@16,144 (conducts)
|
||||||
641 ind_zones@32,144 (conducts)
|
641 ind_zones@32,144 (conducts)(onpower=884)
|
||||||
642 ind_zones@0,160 (conducts)
|
642 ind_zones@0,160 (conducts)
|
||||||
643 ind_zones@16,160 (zone)(conducts)
|
643 ind_zones@16,160 (zone)(conducts)
|
||||||
644 ind_zones@32,160 (conducts)
|
644 ind_zones@32,160 (conducts)(onpower=888)
|
||||||
645 ind_zones@0,176 (conducts)
|
645 ind_zones@0,176 (conducts)
|
||||||
646 ind_zones@16,176 (conducts)
|
646 ind_zones@16,176 (conducts)
|
||||||
647 ind_zones@32,176 (conducts)
|
647 ind_zones@32,176 (conducts)
|
||||||
648 ind_zones@0,192 (conducts)
|
648 ind_zones@0,192 (conducts)
|
||||||
649 ind_zones@16,192 (conducts)
|
649 ind_zones@16,192 (conducts)(onpower=892)
|
||||||
650 ind_zones@32,192 (conducts)
|
650 ind_zones@32,192 (conducts)(onpower=896)
|
||||||
651 ind_zones@0,208 (conducts)
|
651 ind_zones@0,208 (conducts)
|
||||||
652 ind_zones@16,208 (zone)(conducts)
|
652 ind_zones@16,208 (zone)(conducts)
|
||||||
653 ind_zones@32,208 (conducts)
|
653 ind_zones@32,208 (conducts)
|
||||||
|
@ -687,8 +687,8 @@
|
||||||
673 ind_zones@16,320 (conducts)
|
673 ind_zones@16,320 (conducts)
|
||||||
674 ind_zones@32,320 (conducts)
|
674 ind_zones@32,320 (conducts)
|
||||||
675 ind_zones@0,336 (conducts)
|
675 ind_zones@0,336 (conducts)
|
||||||
676 ind_zones@16,336 (conducts)
|
676 ind_zones@16,336 (conducts)(onpower=900)
|
||||||
677 ind_zones@32,336 (conducts)
|
677 ind_zones@32,336 (conducts)(onpower=904)
|
||||||
678 ind_zones@0,352 (conducts)
|
678 ind_zones@0,352 (conducts)
|
||||||
679 ind_zones@16,352 (zone)(conducts)
|
679 ind_zones@16,352 (zone)(conducts)
|
||||||
680 ind_zones@32,352 (conducts)
|
680 ind_zones@32,352 (conducts)
|
||||||
|
@ -697,10 +697,10 @@
|
||||||
683 ind_zones@32,368 (conducts)
|
683 ind_zones@32,368 (conducts)
|
||||||
684 ind_zones@0,384 (conducts)
|
684 ind_zones@0,384 (conducts)
|
||||||
685 ind_zones@16,384 (conducts)
|
685 ind_zones@16,384 (conducts)
|
||||||
686 ind_zones@32,384 (conducts)
|
686 ind_zones@32,384 (conducts)(onpower=908)
|
||||||
687 ind_zones@0,400 (conducts)
|
687 ind_zones@0,400 (conducts)
|
||||||
688 ind_zones@16,400 (zone)(conducts)
|
688 ind_zones@16,400 (zone)(conducts)
|
||||||
689 ind_zones@32,400 (conducts)
|
689 ind_zones@32,400 (conducts)(onpower=912)
|
||||||
690 ind_zones@0,416 (conducts)
|
690 ind_zones@0,416 (conducts)
|
||||||
691 ind_zones@16,416 (conducts)
|
691 ind_zones@16,416 (conducts)
|
||||||
692 ind_zones@32,416 (conducts)
|
692 ind_zones@32,416 (conducts)
|
||||||
|
@ -876,14 +876,14 @@
|
||||||
850 misc_animation@0,368 (becomes=851)
|
850 misc_animation@0,368 (becomes=851)
|
||||||
851 misc_animation@0,384 (becomes=844)
|
851 misc_animation@0,384 (becomes=844)
|
||||||
# BEGIN INDUSTRIAL ANIMATION (8 frames) #
|
# BEGIN INDUSTRIAL ANIMATION (8 frames) #
|
||||||
852 misc_animation@0,400 (conducts) (becomes=853)
|
852 misc_animation@0,400 (conducts) (becomes=853)(onshutdown=621)
|
||||||
853 misc_animation@0,416 (conducts) (becomes=854)
|
853 misc_animation@0,416 (conducts) (becomes=854)(onshutdown=621)
|
||||||
854 misc_animation@0,432 (conducts) (becomes=855)
|
854 misc_animation@0,432 (conducts) (becomes=855)(onshutdown=621)
|
||||||
855 misc_animation@0,448 (conducts) (becomes=856)
|
855 misc_animation@0,448 (conducts) (becomes=856)(onshutdown=621)
|
||||||
856 misc_animation@0,464 (conducts) (becomes=857)
|
856 misc_animation@0,464 (conducts) (becomes=857)(onshutdown=621)
|
||||||
857 misc_animation@0,480 (conducts) (becomes=858)
|
857 misc_animation@0,480 (conducts) (becomes=858)(onshutdown=621)
|
||||||
858 misc_animation@0,496 (conducts) (becomes=859)
|
858 misc_animation@0,496 (conducts) (becomes=859)(onshutdown=621)
|
||||||
859 misc_animation@0,512 (conducts) (becomes=852)
|
859 misc_animation@0,512 (conducts) (becomes=852)(onshutdown=621)
|
||||||
# BEGIN ZONE DESTRUCT & RUBBLIZE #
|
# BEGIN ZONE DESTRUCT & RUBBLIZE #
|
||||||
860 misc_animation@0,528 (noburn) (becomes=861)
|
860 misc_animation@0,528 (noburn) (becomes=861)
|
||||||
861 misc_animation@0,544 (noburn) (becomes=862)
|
861 misc_animation@0,544 (noburn) (becomes=862)
|
||||||
|
@ -911,38 +911,38 @@
|
||||||
882 misc_animation@0,880
|
882 misc_animation@0,880
|
||||||
883 misc_animation@0,896
|
883 misc_animation@0,896
|
||||||
# BEGIN SMOKE STACKS #
|
# BEGIN SMOKE STACKS #
|
||||||
884 misc_animation@0,912 (conducts) (becomes=885)
|
884 misc_animation@0,912 (conducts) (becomes=885)(onshutdown=641)
|
||||||
885 misc_animation@0,928 (conducts) (becomes=886)
|
885 misc_animation@0,928 (conducts) (becomes=886)(onshutdown=641)
|
||||||
886 misc_animation@0,944 (conducts) (becomes=887)
|
886 misc_animation@0,944 (conducts) (becomes=887)(onshutdown=641)
|
||||||
887 misc_animation@0,960 (conducts) (becomes=884)
|
887 misc_animation@0,960 (conducts) (becomes=884)(onshutdown=641)
|
||||||
888 misc_animation@0,976 (conducts) (becomes=889)
|
888 misc_animation@0,976 (conducts) (becomes=889)(onshutdown=644)
|
||||||
889 misc_animation@0,992 (conducts) (becomes=890)
|
889 misc_animation@0,992 (conducts) (becomes=890)(onshutdown=644)
|
||||||
890 misc_animation@0,1008 (conducts) (becomes=891)
|
890 misc_animation@0,1008 (conducts) (becomes=891)(onshutdown=644)
|
||||||
891 misc_animation@0,1024 (conducts) (becomes=888)
|
891 misc_animation@0,1024 (conducts) (becomes=888)(onshutdown=644)
|
||||||
892 misc_animation@0,1040 (conducts) (becomes=893)
|
892 misc_animation@0,1040 (conducts) (becomes=893)(onshutdown=649)
|
||||||
893 misc_animation@0,1056 (conducts) (becomes=894)
|
893 misc_animation@0,1056 (conducts) (becomes=894)(onshutdown=649)
|
||||||
894 misc_animation@0,1072 (conducts) (becomes=895)
|
894 misc_animation@0,1072 (conducts) (becomes=895)(onshutdown=649)
|
||||||
895 misc_animation@0,1088 (conducts) (becomes=892)
|
895 misc_animation@0,1088 (conducts) (becomes=892)(onshutdown=649)
|
||||||
896 misc_animation@0,1104 (conducts) (becomes=897)
|
896 misc_animation@0,1104 (conducts) (becomes=897)(onshutdown=650)
|
||||||
897 misc_animation@0,1120 (conducts) (becomes=898)
|
897 misc_animation@0,1120 (conducts) (becomes=898)(onshutdown=650)
|
||||||
898 misc_animation@0,1136 (conducts) (becomes=899)
|
898 misc_animation@0,1136 (conducts) (becomes=899)(onshutdown=650)
|
||||||
899 misc_animation@0,1152 (conducts) (becomes=896)
|
899 misc_animation@0,1152 (conducts) (becomes=896)(onshutdown=650)
|
||||||
900 misc_animation@0,1168 (conducts) (becomes=901)
|
900 misc_animation@0,1168 (conducts) (becomes=901)(onshutdown=676)
|
||||||
901 misc_animation@0,1184 (conducts) (becomes=902)
|
901 misc_animation@0,1184 (conducts) (becomes=902)(onshutdown=676)
|
||||||
902 misc_animation@0,1200 (conducts) (becomes=903)
|
902 misc_animation@0,1200 (conducts) (becomes=903)(onshutdown=676)
|
||||||
903 misc_animation@0,1216 (conducts) (becomes=900)
|
903 misc_animation@0,1216 (conducts) (becomes=900)(onshutdown=676)
|
||||||
904 misc_animation@0,1232 (conducts) (becomes=905)
|
904 misc_animation@0,1232 (conducts) (becomes=905)(onshutdown=677)
|
||||||
905 misc_animation@0,1248 (conducts) (becomes=906)
|
905 misc_animation@0,1248 (conducts) (becomes=906)(onshutdown=677)
|
||||||
906 misc_animation@0,1264 (conducts) (becomes=907)
|
906 misc_animation@0,1264 (conducts) (becomes=907)(onshutdown=677)
|
||||||
907 misc_animation@0,1280 (conducts) (becomes=904)
|
907 misc_animation@0,1280 (conducts) (becomes=904)(onshutdown=677)
|
||||||
908 misc_animation@0,1296 (conducts) (becomes=909)
|
908 misc_animation@0,1296 (conducts) (becomes=909)(onshutdown=686)
|
||||||
909 misc_animation@0,1312 (conducts) (becomes=910)
|
909 misc_animation@0,1312 (conducts) (becomes=910)(onshutdown=686)
|
||||||
910 misc_animation@0,1328 (conducts) (becomes=911)
|
910 misc_animation@0,1328 (conducts) (becomes=911)(onshutdown=686)
|
||||||
911 misc_animation@0,1344 (conducts) (becomes=908)
|
911 misc_animation@0,1344 (conducts) (becomes=908)(onshutdown=686)
|
||||||
912 misc_animation@0,1360 (conducts) (becomes=913)
|
912 misc_animation@0,1360 (conducts) (becomes=913)(onshutdown=689)
|
||||||
913 misc_animation@0,1376 (conducts) (becomes=914)
|
913 misc_animation@0,1376 (conducts) (becomes=914)(onshutdown=689)
|
||||||
914 misc_animation@0,1392 (conducts) (becomes=915)
|
914 misc_animation@0,1392 (conducts) (becomes=915)(onshutdown=689)
|
||||||
915 misc_animation@0,1408 (conducts) (becomes=912)
|
915 misc_animation@0,1408 (conducts) (becomes=912)(onshutdown=689)
|
||||||
# BEGIN COAL PLANT SMOKE #
|
# BEGIN COAL PLANT SMOKE #
|
||||||
916 misc_animation@0,1424 (conducts) (becomes=917)(onshutdown=747)
|
916 misc_animation@0,1424 (conducts) (becomes=917)(onshutdown=747)
|
||||||
917 misc_animation@0,1440 (conducts) (becomes=918)(onshutdown=747)
|
917 misc_animation@0,1440 (conducts) (becomes=918)(onshutdown=747)
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
// This file is part of MicropolisJ.
|
|
||||||
// Copyright (C) 2013 Jason Long
|
|
||||||
// Portions Copyright (C) 1989-2007 Electronic Arts Inc.
|
|
||||||
//
|
|
||||||
// MicropolisJ is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU GPLv3, with additional terms.
|
|
||||||
// See the README file, included in this distribution, for details.
|
|
||||||
|
|
||||||
package micropolisj.engine;
|
|
||||||
|
|
||||||
import static micropolisj.engine.TileConstants.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains data used for tile animation.
|
|
||||||
*/
|
|
||||||
class Animate
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Contains data used for industrial zone animations.
|
|
||||||
*/
|
|
||||||
static class Smoke
|
|
||||||
{
|
|
||||||
// There are eight full Industry-zone images in the tiles bank.
|
|
||||||
// This array indicates which of those eight zones have an animation.
|
|
||||||
static boolean [] AniThis = {true, false, true, true, false, false, true, true };
|
|
||||||
|
|
||||||
// Up to two tiles can be animated. Arrays DX1,DY1 indicate the relative
|
|
||||||
// position of the first animated tile.
|
|
||||||
static int [] DX1 = { -1, 0, 1, 0, 0, 0, 0, 1 };
|
|
||||||
static int [] DY1 = { -1, 0, -1, -1, 0, 0, -1, -1 };
|
|
||||||
|
|
||||||
// Arrays DX2,DY2 indicate the second animated tile.
|
|
||||||
static int [] DX2 = { -1, 0, 1, 1, 0, 0, 1, 1 };
|
|
||||||
static int [] DY2 = { -1, 0, 0, -1, 0, 0, -1, 0 };
|
|
||||||
|
|
||||||
static int [] AniTabA = { 0, 0, 32, 40, 0, 0, 48, 56 };
|
|
||||||
static int [] AniTabB = { 0, 0, 36, 44, 0, 0, 52, 60 };
|
|
||||||
static int [] AniTabC = { IND1, 0, IND2, IND4, 0, 0, IND6, IND8 };
|
|
||||||
static int [] AniTabD = { IND1, 0, IND3, IND5, 0, 0, IND7, IND9 };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ import java.util.*;
|
||||||
|
|
||||||
import static micropolisj.engine.TileConstants.*;
|
import static micropolisj.engine.TileConstants.*;
|
||||||
import static micropolisj.engine.Micropolis.ZoneType;
|
import static micropolisj.engine.Micropolis.ZoneType;
|
||||||
import static micropolisj.engine.Animate.Smoke;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process individual tiles of the map for each cycle.
|
* Process individual tiles of the map for each cycle.
|
||||||
|
@ -822,63 +821,6 @@ class MapScanner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Animate tiles in an industrial zone.
|
|
||||||
* Note: pollution is not accumulated here; it is instead
|
|
||||||
* accumulated in ptlScan(), by adding up each tile's
|
|
||||||
* pollution value.
|
|
||||||
*
|
|
||||||
* @param powerOn indicates whether the building has power
|
|
||||||
*/
|
|
||||||
void setSmoke(boolean powerOn)
|
|
||||||
{
|
|
||||||
int cchr9 = cchr & LOMASK;
|
|
||||||
|
|
||||||
if (cchr9 < IZB)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int z = ((cchr9 - IZB) / 8) % 8;
|
|
||||||
if (Smoke.AniThis[z])
|
|
||||||
{
|
|
||||||
int xx = xpos + Smoke.DX1[z];
|
|
||||||
int yy = ypos + Smoke.DY1[z];
|
|
||||||
|
|
||||||
if (city.testBounds(xx, yy))
|
|
||||||
{
|
|
||||||
int t = city.map[yy][xx] & LOMASK;
|
|
||||||
|
|
||||||
if (powerOn) {
|
|
||||||
if (t == Smoke.AniTabC[z]) //expected non-animated tile
|
|
||||||
{
|
|
||||||
city.setTile(xx,yy,(char)(SMOKEBASE + Smoke.AniTabA[z]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (t > Smoke.AniTabC[z]) {
|
|
||||||
city.setTile(xx,yy,(char)(Smoke.AniTabC[z]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xx = xpos + Smoke.DX2[z];
|
|
||||||
yy = ypos + Smoke.DY2[z];
|
|
||||||
if (city.testBounds(xx, yy) && !(Smoke.DX1[z] == Smoke.DX2[z] && Smoke.DY1[z] == Smoke.DY2[z]))
|
|
||||||
{
|
|
||||||
int t = city.map[yy][xx] & LOMASK;
|
|
||||||
if (powerOn) {
|
|
||||||
if (t == Smoke.AniTabD[z]) {
|
|
||||||
city.setTile(xx,yy,(char)(SMOKEBASE + Smoke.AniTabB[z]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (t > Smoke.AniTabD[z]) {
|
|
||||||
city.setTile(xx,yy,(char)(Smoke.AniTabD[z]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the current tile is the key tile of an
|
* Called when the current tile is the key tile of an
|
||||||
* industrial zone.
|
* industrial zone.
|
||||||
|
@ -887,7 +829,6 @@ class MapScanner
|
||||||
void doIndustrial(boolean powerOn)
|
void doIndustrial(boolean powerOn)
|
||||||
{
|
{
|
||||||
city.indZoneCount++;
|
city.indZoneCount++;
|
||||||
setSmoke(powerOn);
|
|
||||||
|
|
||||||
int tpop = industrialZonePop(cchr);
|
int tpop = industrialZonePop(cchr);
|
||||||
city.indPop += tpop;
|
city.indPop += tpop;
|
||||||
|
|
Reference in a new issue