Add truncation warnings for Block masks
This commit is contained in:
parent
59f0d9fe11
commit
a0069b6a3f
1 changed files with 21 additions and 10 deletions
|
@ -1977,18 +1977,29 @@ bool Project::readFieldmapMasks() {
|
||||||
projectConfig.setSaveDisabled(true);
|
projectConfig.setSaveDisabled(true);
|
||||||
|
|
||||||
// Read Block masks
|
// Read Block masks
|
||||||
auto it = defines.find(metatileIdMaskName);
|
auto readBlockMask = [defines](const QString name, uint16_t *value) {
|
||||||
if (it != defines.end())
|
auto it = defines.find(name);
|
||||||
projectConfig.setBlockMetatileIdMask(static_cast<uint16_t>(it.value()));
|
if (it == defines.end())
|
||||||
it = defines.find(collisionMaskName);
|
return false;
|
||||||
if (it != defines.end())
|
*value = static_cast<uint16_t>(it.value());
|
||||||
projectConfig.setBlockCollisionMask(static_cast<uint16_t>(it.value()));
|
if (*value != it.value()){
|
||||||
it = defines.find(elevationMaskName);
|
logWarn(QString("Value for %1 truncated from '0x%2' to '0x%3'")
|
||||||
if (it != defines.end())
|
.arg(name)
|
||||||
projectConfig.setBlockElevationMask(static_cast<uint16_t>(it.value()));
|
.arg(QString::number(it.value(), 16).toUpper())
|
||||||
|
.arg(QString::number(*value, 16).toUpper()));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
uint16_t blockMask;
|
||||||
|
if (readBlockMask(metatileIdMaskName, &blockMask))
|
||||||
|
projectConfig.setBlockMetatileIdMask(blockMask);
|
||||||
|
if (readBlockMask(collisionMaskName, &blockMask))
|
||||||
|
projectConfig.setBlockCollisionMask(blockMask);
|
||||||
|
if (readBlockMask(elevationMaskName, &blockMask))
|
||||||
|
projectConfig.setBlockElevationMask(blockMask);
|
||||||
|
|
||||||
// Read RSE metatile attribute masks
|
// Read RSE metatile attribute masks
|
||||||
it = defines.find(behaviorMaskName);
|
auto it = defines.find(behaviorMaskName);
|
||||||
if (it != defines.end())
|
if (it != defines.end())
|
||||||
projectConfig.setMetatileBehaviorMask(static_cast<uint32_t>(it.value()));
|
projectConfig.setMetatileBehaviorMask(static_cast<uint32_t>(it.value()));
|
||||||
it = defines.find(layerTypeMaskName);
|
it = defines.find(layerTypeMaskName);
|
||||||
|
|
Loading…
Reference in a new issue