Ta classe Map n'est pas du tout à jour.
Tu sautes une condition sur la variable mapVersion.
public function fromRaw(param1:IDataInput, param2:ByteArray = null) : void
{
var i:int = 0;
var header:int = 0;
var bg:Fixture = null;
var la:Layer = null;
var _oldMvtSystem:uint = 0;
var cd:CellData = null;
var dataLen:uint = 0;
var encryptedData:ByteArray = null;
var readColor:int = 0;
var gridAlpha:int = 0;
var gridRed:int = 0;
var gridGreen:int = 0;
var gridBlue:int = 0;
var fg:Fixture = null;
var raw:IDataInput = param1;
var decryptionKey:ByteArray = param2;
try
{
header = raw.readByte();
if(header != 77)
{
throw new DataFormatError("Unknown file format");
}
this.mapVersion = raw.readByte();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Map version : " + this.mapVersion);
}
this.id = raw.readUnsignedInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Map id : " + this.id);
}
if(this.mapVersion >= 7)
{
this.encrypted = raw.readBoolean();
this.encryptionVersion = raw.readByte();
dataLen = raw.readInt();
if(this.encrypted)
{
if(!decryptionKey)
{
throw new IllegalOperationError("Map decryption key is empty");
}
encryptedData = new ByteArray();
raw.readBytes(encryptedData,0,dataLen);
i = 0;
while(i < encryptedData.length)
{
encryptedData = encryptedData ^ decryptionKey[i % decryptionKey.length];
i++;
}
encryptedData.position = 0;
raw = encryptedData;
}
}
this.relativeId = raw.readUnsignedInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Map relativeId: " + this.relativeId);
}
this.mapType = raw.readByte();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Map type : " + this.mapType);
}
this.subareaId = raw.readInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Subarea id : " + this.subareaId);
}
this.topNeighbourId = raw.readInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("topNeighbourId : " + this.topNeighbourId);
}
this.bottomNeighbourId = raw.readInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("bottomNeighbourId : " + this.bottomNeighbourId);
}
this.leftNeighbourId = raw.readInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("leftNeighbourId : " + this.leftNeighbourId);
}
this.rightNeighbourId = raw.readInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("rightNeighbourId : " + this.rightNeighbourId);
}
this.shadowBonusOnEntities = raw.readUnsignedInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("ShadowBonusOnEntities : " + this.shadowBonusOnEntities);
}
if(this.mapVersion >= 9)
{
readColor = raw.readInt();
this.backgroundAlpha = (readColor & 4.27819008E9) >> 32;
this.backgroundRed = (readColor & 16711680) >> 16;
this.backgroundGreen = (readColor & 65280) >> 8;
this.backgroundBlue = readColor & 255;
readColor = raw.readUnsignedInt();
gridAlpha = (readColor & 4.27819008E9) >> 32;
gridRed = (readColor & 16711680) >> 16;
gridGreen = (readColor & 65280) >> 8;
gridBlue = readColor & 255;
this.gridColor = (gridAlpha & 255) << 32 | (gridRed & 255) << 16 | (gridGreen & 255) << 8 | gridBlue & 255;
}
else if(this.mapVersion >= 3)
{
this.backgroundRed = raw.readByte();
this.backgroundGreen = raw.readByte();
this.backgroundBlue = raw.readByte();
}
this.backgroundColor = (this.backgroundAlpha & 255) << 32 | (this.backgroundRed & 255) << 16 | (this.backgroundGreen & 255) << 8 | this.backgroundBlue & 255;
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("BackgroundColor : " + this.backgroundRed + "," + this.backgroundGreen + "," + this.backgroundBlue);
}
if(this.mapVersion >= 4)
{
this.zoomScale = raw.readUnsignedShort() / 100;
this.zoomOffsetX = raw.readShort();
this.zoomOffsetY = raw.readShort();
if(this.zoomScale < 1)
{
this.zoomScale = 1;
this.zoomOffsetY = 0;
this.zoomOffsetX = 0;
}
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Zoom auto : " + this.zoomScale + "," + this.zoomOffsetX + "," + this.zoomOffsetY);
}
}
this.useLowPassFilter = raw.readByte() == 1;
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("useLowPassFilter : " + this.useLowPassFilter);
}
this.useReverb = raw.readByte() == 1;
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("useReverb : " + this.useReverb);
}
if(this.useReverb)
{
this.presetId = raw.readInt();
}
else
{
this.presetId = -1;
}
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("presetId : " + this.presetId);
}
this.backgroundsCount = raw.readByte();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Backgrounds count : " + this.backgroundsCount);
}
this.backgroundFixtures = new Array();
i = 0;
while(i < this.backgroundsCount)
{
bg = new Fixture(this);
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Background at index " + i + " :");
}
bg.fromRaw(raw);
this.backgroundFixtures.push(bg);
i++;
}
this.foregroundsCount = raw.readByte();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Foregrounds count : " + this.foregroundsCount);
}
this.foregroundFixtures = new Array();
i = 0;
while(i < this.foregroundsCount)
{
fg = new Fixture(this);
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Foreground at index " + i + " :");
}
fg.fromRaw(raw);
this.foregroundFixtures.push(fg);
i++;
}
this.cellsCount = AtouinConstants.MAP_CELLS_COUNT;
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Cells count : " + this.cellsCount);
}
raw.readInt();
this.groundCRC = raw.readInt();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("groundCRC : " + this.groundCRC);
}
this.layersCount = raw.readByte();
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Layers count : " + this.layersCount);
}
this.layers = new Array();
i = 0;
while(i < this.layersCount)
{
la = new Layer(this);
if(AtouinConstants.DEBUG_FILES_PARSING)
{
_log.debug("Layer at index " + i + " :");
}
la.fromRaw(raw,this.mapVersion);
this.layers.push(la);
i++;
}
this.cells = new Array();
i = 0;
while(i < this.cellsCount)
{
cd = new CellData(this,i);
cd.fromRaw(raw);
if(!_oldMvtSystem)
{
_oldMvtSystem = cd.moveZone;
}
if(cd.moveZone != _oldMvtSystem)
{
this.isUsingNewMovementSystem = true;
}
this.cells.push(cd);
i++;
}
if(AtouinConstants.DEBUG_FILES_PARSING)
{
trace(this.isUsingNewMovementSystem?"This map is using the new movement system":"This map is using the old movement system");
}
this._parsed = true;
return;
}
catch(e:*)
{
_failed = true;
throw e;
}
}