public override bool LoadFromBytes(byte[] bytes) { //Need the offset before loading if (_levelInfoOffset == -1 || _levelHeaderOffset == -1) return false; base.LoadFromBytes(bytes); if (LevelObjects == null) LevelObjects = new List<SFLevelObject>(); LevelObjects.Clear(); if (LevelScripts == null) LevelScripts = new List<SFAdvancedObjectScript>(); LevelScripts.Clear(); byte[] data; if (!_dmaData.TakeMemory(_levelHeaderOffset, LevelHeader.Size, out data)) return false; LevelHeader = new DataObjects.LevelHeader(_levelHeaderOffset, data); int levelObjectOffset = _levelInfoOffset; bool one = true; while (one) { if (!_dmaData.TakeMemory(levelObjectOffset, SFLevelObject.Size, out data)) break; SFLevelObject newObj = new SFLevelObject(levelObjectOffset, data); // default dlist offset to 0 newObj.DListOffset = 0x00; // if object id == 0xffff, break out because this marks end of data! if (newObj.ID == 0xFFFF) break; levelObjectOffset += SFLevelObject.Size; LevelObjects.Add(newObj); } return true; }
public SFLevelObjectInfo(SFLevelObject obj) { _obj = obj; }