(svn r20621) -Codechange: move animation frames of houses, objects and industries to m7 (same as airports and stations)

This commit is contained in:
rubidium
2010-08-26 14:36:00 +00:00
parent 03f28f0b06
commit 1d8b95b235
8 changed files with 94 additions and 62 deletions

View File

@@ -1283,19 +1283,19 @@ bool AfterLoadGame()
if (IsTileType(t, MP_INDUSTRY)) {
switch (GetIndustryGfx(t)) {
case GFX_POWERPLANT_SPARKS:
SetIndustryAnimationState(t, GB(_m[t].m1, 2, 5));
_m[t].m3 = GB(_m[t].m1, 2, 5);
break;
case GFX_OILWELL_ANIMATED_1:
case GFX_OILWELL_ANIMATED_2:
case GFX_OILWELL_ANIMATED_3:
SetIndustryAnimationState(t, GB(_m[t].m1, 0, 2));
_m[t].m3 = GB(_m[t].m1, 0, 2);
break;
case GFX_COAL_MINE_TOWER_ANIMATED:
case GFX_COPPER_MINE_TOWER_ANIMATED:
case GFX_GOLD_MINE_TOWER_ANIMATED:
SetIndustryAnimationState(t, _m[t].m1);
_m[t].m3 = _m[t].m1;
break;
default: // No animation states to change
@@ -1684,7 +1684,8 @@ bool AfterLoadGame()
/* Increase HouseAnimationFrame from 5 to 7 bits */
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_HOUSE) && GetHouseType(t) >= NEW_HOUSE_OFFSET) {
SetHouseAnimationFrame(t, GB(_m[t].m6, 3, 5));
SB(_m[t].m6, 2, 6, GB(_m[t].m6, 3, 5));
SB(_m[t].m3, 5, 1, 0);
}
}
}
@@ -2249,6 +2250,38 @@ bool AfterLoadGame()
}
}
/* Move the animation frame to the same location (m7) for all objects. */
if (CheckSavegameVersion(147)) {
for (TileIndex t = 0; t < map_size; t++) {
switch (GetTileType(t)) {
case MP_HOUSE:
if (GetHouseType(t) >= NEW_HOUSE_OFFSET) {
uint per_proc = _me[t].m7;
_me[t].m7 = GB(_m[t].m6, 2, 6) | (GB(_m[t].m3, 5, 1) << 6);
SB(_m[t].m3, 5, 1, 0);
SB(_m[t].m6, 2, 6, min(per_proc, 63));
}
break;
case MP_INDUSTRY: {
uint rand = _me[t].m7;
_me[t].m7 = _m[t].m3;
_m[t].m3 = rand;
break;
}
case MP_OBJECT:
_me[t].m7 = _m[t].m3;
_m[t].m3 = 0;
break;
default:
/* For stations/airports it's already at m7 */
break;
}
}
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();