Industry: Apply anim tile masking when loading prior version saves
This commit is contained in:
@@ -459,3 +459,30 @@ void AnalyseIndustryTileSpriteGroups()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ApplyIndustryTileAnimMasking()
|
||||||
|
{
|
||||||
|
for (Industry *ind : Industry::Iterate()) {
|
||||||
|
const IndustrySpec *spec = GetIndustrySpec(ind->type);
|
||||||
|
|
||||||
|
if (ind->selected_layout == 0 || ind->selected_layout > spec->layouts.size()) continue;
|
||||||
|
|
||||||
|
uint64 mask = spec->layout_anim_masks[ind->selected_layout - 1];
|
||||||
|
|
||||||
|
uint idx = 0;
|
||||||
|
for (IndustryTileLayoutTile it : spec->layouts[ind->selected_layout - 1]) {
|
||||||
|
if (it.gfx == 0xFF) continue;
|
||||||
|
|
||||||
|
TileIndex tile = AddTileIndexDiffCWrap(ind->location.tile, it.ti);
|
||||||
|
if (!IsValidTile(tile) || !ind->TileBelongsToIndustry(tile)) break;
|
||||||
|
|
||||||
|
IndustryGfx gfx = GetTranslatedIndustryTileID(it.gfx);
|
||||||
|
if (gfx != GetIndustryGfx(tile)) break;
|
||||||
|
|
||||||
|
if (HasBit(mask, idx)) DeleteAnimatedTile(tile);
|
||||||
|
|
||||||
|
idx++;
|
||||||
|
if (idx == 64) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -77,5 +77,6 @@ void TriggerIndustryTile(TileIndex t, IndustryTileTrigger trigger);
|
|||||||
void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger);
|
void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger);
|
||||||
|
|
||||||
void AnalyseIndustryTileSpriteGroups();
|
void AnalyseIndustryTileSpriteGroups();
|
||||||
|
void ApplyIndustryTileAnimMasking();
|
||||||
|
|
||||||
#endif /* NEWGRF_INDUSTRYTILES_H */
|
#endif /* NEWGRF_INDUSTRYTILES_H */
|
||||||
|
@@ -4051,6 +4051,10 @@ bool AfterLoadGame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SlXvIsFeatureMissing(XSLFI_INDUSTRY_ANIM_MASK)) {
|
||||||
|
ApplyIndustryTileAnimMasking();
|
||||||
|
}
|
||||||
|
|
||||||
InitializeRoadGUI();
|
InitializeRoadGUI();
|
||||||
|
|
||||||
/* This needs to be done after conversion. */
|
/* This needs to be done after conversion. */
|
||||||
|
@@ -172,6 +172,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
|||||||
{ XSLFI_MORE_STATION_TYPES, XSCF_NULL, 1, 1, "more_station_types", nullptr, nullptr, nullptr },
|
{ XSLFI_MORE_STATION_TYPES, XSCF_NULL, 1, 1, "more_station_types", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_RV_ORDER_EXTRA_FLAGS, XSCF_IGNORABLE_UNKNOWN, 1, 1, "rv_order_extra_flags", nullptr, nullptr, nullptr },
|
{ XSLFI_RV_ORDER_EXTRA_FLAGS, XSCF_IGNORABLE_UNKNOWN, 1, 1, "rv_order_extra_flags", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_GRF_ROADSTOPS, XSCF_NULL, 1, 1, "grf_road_stops", nullptr, nullptr, nullptr },
|
{ XSLFI_GRF_ROADSTOPS, XSCF_NULL, 1, 1, "grf_road_stops", nullptr, nullptr, nullptr },
|
||||||
|
{ XSLFI_INDUSTRY_ANIM_MASK, XSCF_IGNORABLE_ALL, 1, 1, "industry_anim_mask", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr },
|
{ XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
|
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
|
||||||
};
|
};
|
||||||
|
@@ -125,6 +125,7 @@ enum SlXvFeatureIndex {
|
|||||||
XSLFI_MORE_STATION_TYPES, ///< More station types (field widening)
|
XSLFI_MORE_STATION_TYPES, ///< More station types (field widening)
|
||||||
XSLFI_RV_ORDER_EXTRA_FLAGS, ///< Road vehicle order extra flags
|
XSLFI_RV_ORDER_EXTRA_FLAGS, ///< Road vehicle order extra flags
|
||||||
XSLFI_GRF_ROADSTOPS, ///< NewGRF road stops
|
XSLFI_GRF_ROADSTOPS, ///< NewGRF road stops
|
||||||
|
XSLFI_INDUSTRY_ANIM_MASK, ///< Industry tile animation masking
|
||||||
|
|
||||||
XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64
|
XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user