protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            type.Read(reader, this, "type");
            numSounds.Read(reader, this, "numSounds");

            // A sound was ommitted from flameh and sgwindw in one version of the game, but the array length is still 2.
            // Hack to make it export correctly.
            if (reader.Object != null &&
                reader.Object.Name == "flameh__" &&
                reader.Model.Start == Start + 0x18)
            {
                sounds = new SR1_StructureArray <ObjectSound>(1);
            }
            else if (reader.Object != null &&
                     reader.Object.Name == "sgwindw_" &&
                     reader.Model.Start == Start + 0x24)
            {
                sounds = new SR1_StructureArray <ObjectSound>(2);
            }
            else
            {
                sounds = new SR1_StructureArray <ObjectSound>(numSounds.Value);
            }

            sounds.Read(reader, this, "entries");
        }
示例#2
0
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            numVMOffsets.Read(reader, this, "numVMOffsets");

            offsets = (SR1_StructureArray <VMMoveOffset>)(new SR1_StructureArray <VMMoveOffset>(numVMOffsets.Value)).SetPadding(4);
            offsets.Read(reader, this, "offsets");
        }
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            key.Read(reader, this, "key");
            numkeys.Read(reader, this, "numkeys");
            type.Read(reader, this, "type");
            flags.Read(reader, this, "flags");

            keyList = new SR1_StructureArray <SplineKey>(numkeys.Value);
            keyList.Read(reader, this, "keyList");
        }
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            if (!skipAmbient)
            {
                ambient.Read(reader, this, "ambient");
            }

            numLightGroups.Read(reader, this, "numLightGroups");
            lightGroupList.Read(reader, this, "lightGroupList");

            lightGroupListBuf = new SR1_StructureArray <LightGroup>(numLightGroups.Value);
            lightGroupListBuf.Read(reader, this, "lightGroupListBuf");
        }
示例#5
0
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            keyListPointers = new SR1_PointerArray <G2AnimKeylist_Type>(_NumAnims, false);
            keyListPointers.Read(reader, this, "keyListPointers");

            SR1_StructureArray <G2AnimKeylist_Type> keyLists = new SR1_StructureArray <G2AnimKeylist_Type>(_NumAnims);

            keyLists.ReadFromPointer(reader, keyListPointers[0]);

            SR1_StructureArray <G2AnimFXList> fxLists = new SR1_StructureArray <G2AnimFXList>(reader.AnimFXDictionary.Count);

            fxLists.SetPadding(4).ReadFromPointer(reader, reader.AnimFXDictionary.Values[0]);
        }
        protected override void ReadReferences(SR1_Reader reader, SR1_Structure parent)
        {
            Level level = (Level)reader.File._Structures[0];
            SR1_StructureArray <Intro> intros = (SR1_StructureArray <Intro>)reader.File._Structures[level.introList.Offset];

            foreach (Intro intro in intros)
            {
                if (intro.UniqueID.Value == introUniqueID.Value)
                {
                    Intro = intro;
                    break;
                }
            }
        }
示例#7
0
        protected override void ReadReferences(SR1_Reader reader, SR1_Structure parent)
        {
            new SR1_StructureArray <MVertex>(numVertices.Value).ReadFromPointer(reader, vertexList);
            SR1_Structure normalsStruct = new SR1_StructureArray <SVectorNoPad>(numNormals.Value).ReadFromPointer(reader, normalList);

            new SR1_StructureArray <MFace>(numFaces.Value).ReadFromPointer(reader, faceList);
            new SR1_StructureArray <Segment>(numSegments.Value).ReadFromPointer(reader, segmentList);
            new AniTex().ReadFromPointer(reader, aniTextures);
            new SR1_StructureSeries <TextureMT3>((int)(endTextures.Offset - startTextures.Offset)).ReadFromPointer(reader, startTextures);

            // This needs to be at the end so that other structures can be checked for first.
            // The padding was causing issues when it was at the very end of the file.
            if (normalsStruct.End != reader.BaseStream.Length && !reader.File._Structures.ContainsKey(normalsStruct.End))
            {
                new SR1_PrimativeArray <byte>(0).SetPadding(4).ReadOrphan(reader, normalsStruct.End);
            }
        }
示例#8
0
        protected override void ReadReferences(SR1_Reader reader, SR1_Structure parent)
        {
            new IdleList().ReadFromPointer(reader, idleList);
            new AttackItemList().ReadFromPointer(reader, attackList);
            new ThrowItemSet().ReadFromPointer(reader, throwList);
            new SAnimSet().ReadFromPointer(reader, stringAnimations);

            if (reader.IdleAnimSetDictionary.Count > 0)
            {
                SR1_StructureArray <IdleSet> idleAnimSets = new SR1_StructureArray <IdleSet>(reader.IdleAnimSetDictionary.Count);
                idleAnimSets.ReadFromPointer(reader, reader.IdleAnimSetDictionary.Values[0]);
            }

            if (reader.IdleAnimDictionary.Count > 0)
            {
                SR1_StructureArray <Idle> idleAnims = new SR1_StructureArray <Idle>(reader.IdleAnimDictionary.Count);
                idleAnims.ReadFromPointer(reader, reader.IdleAnimDictionary.Values[0]);
            }

            if (reader.AttackAnimSetDictionary.Count > 0)
            {
                SR1_StructureArray <AttackItemSet> attackAnimSets = new SR1_StructureArray <AttackItemSet>(reader.AttackAnimSetDictionary.Count);
                attackAnimSets.ReadFromPointer(reader, reader.AttackAnimSetDictionary.Values[0]);
            }

            if (reader.AttackAnimDictionary.Count > 0)
            {
                SR1_StructureArray <AttackItem> attackAnims = new SR1_StructureArray <AttackItem>(reader.AttackAnimDictionary.Count);
                attackAnims.ReadFromPointer(reader, reader.AttackAnimDictionary.Values[0]);
            }

            if (reader.ThrowAnimDictionary.Count > 0)
            {
                SR1_StructureArray <ThrowItem> throwAnims = new SR1_StructureArray <ThrowItem>(reader.ThrowAnimDictionary.Count);
                throwAnims.ReadFromPointer(reader, reader.ThrowAnimDictionary.Values[0]);
            }

            new SR1_StructureSeries <VAnim>((int)(virtualAnimSingle.Offset - virtualAnimations.Offset)).ReadFromPointer(reader, virtualAnimations);

            if (reader.SAnimDictionary.Count > 0)
            {
                new SR1_StructureSeries <SAnim>((int)(reader.BaseStream.Length - reader.SAnimDictionary.Values[0].Offset)).ReadFromPointer(reader, reader.SAnimDictionary.Values[0]);
                new SR1_StructureSeries <VAnim>((int)(reader.SAnimDictionary.Values[0].Offset - virtualAnimSingle.Offset)).ReadFromPointer(reader, virtualAnimSingle);
            }
        }
示例#9
0
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            pixDstX.Read(reader, this, "pixDstX");
            pixDstY.Read(reader, this, "pixDstY");
            pixW.Read(reader, this, "pixW");
            pixH.Read(reader, this, "pixH");
            clutDstX.Read(reader, this, "clutDstX");
            clutDstY.Read(reader, this, "clutDstY");
            clutW.Read(reader, this, "clutW");
            clutH.Read(reader, this, "clutH");
            pixCurrentX.Read(reader, this, "pixCurrentX");
            pixCurrentY.Read(reader, this, "pixCurrentY");
            clutCurrentX.Read(reader, this, "clutCurrentX");
            clutCurrentY.Read(reader, this, "clutCurrentY");
            numFrames.Read(reader, this, "numFrames");
            speed.Read(reader, this, "speed");

            frame = new SR1_StructureArray <DrMoveAniTexSrcInfo>(numFrames.Value);
            frame.Read(reader, this, "frame");
        }
示例#10
0
        protected override void ReadReferences(SR1_Reader reader, SR1_Structure parent)
        {
            SR1_Structure temp;

            temp = new SR1_StructureArray <PhysObProjectileData>(totalProjectiles.Value).ReadFromPointer(reader, data[0]);

            long nextEnd = End;

            while (nextEnd != temp.Start)
            {
                if (reader.File._Structures.ContainsKey((uint)nextEnd))
                {
                    nextEnd = reader.File._Structures[(uint)nextEnd].End;
                }
                else
                {
                    reader.BaseStream.Position = nextEnd;
                    new PhysObWeaponAttributes().Read(reader, null, "");
                    nextEnd = reader.BaseStream.Position;
                }
            }
        }
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            initFunc.Read(reader, this, "initFunc");
            cleanUpFunc.Read(reader, this, "cleanUpFunc");
            damageEffectFunc.Read(reader, this, "damageEffectFunc");
            queryFunc.Read(reader, this, "queryFunc");
            messageFunc.Read(reader, this, "messageFunc");
            stateFuncs.Read(reader, this, "stateFuncs");
            versionID.Read(reader, this, "versionID");
            localVersionID.Read(reader, this, "localVersionID");

            int codeLength = (int)((long)(Start + stateFuncs.Value) - localVersionID.End);

            asmCode = new SR1_PrimativeArray <byte>(codeLength);
            asmCode.Read(reader, this, "asmCode");

            int numChoices             = 0;
            MonsterStateChoice tempMSC = new MonsterStateChoice();

            do
            {
                numChoices++;
                tempMSC.ReadTemp(reader);
            }while (tempMSC.state.Value != -1);

            reader.BaseStream.Position = asmCode.End;

            stateChoices = new SR1_StructureArray <MonsterStateChoice>(numChoices);
            stateChoices.Read(reader, this, "stateChoices");

            // Padding is used by the asmCode maybe?
            if (reader.File._Version >= SR1_File.Version.May12 &&
                (reader.Object.Name == "alukabss" || reader.Object.Name == "roninbss"))
            {
                pad = new SR1_PrimativeArray <byte>(8);
            }
            pad.Read(reader, this, "pad");
        }
 protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
 {
     numAniTextures.Read(reader, this, "numAniTextures");
     aniTexInfo = new SR1_StructureArray <AniTexInfo>(numAniTextures.Value);
     aniTexInfo.Read(reader, this, "aniTexInfo");
 }
        protected override void ReadReferences(SR1_Reader reader, SR1_Structure parent)
        {
            SR1_Structure temp = null;

            if (numVertices.Value > 0)
            {
                new SR1_StructureArray <TVertex>(numVertices.Value).ReadFromPointer(reader, vertexList);
            }

            SR1_StructureArray <TFace> faces = new SR1_StructureArray <TFace>(0);

            if (numFaces.Value > 0)
            {
                faces = new SR1_StructureArray <TFace>(numFaces.Value);
                faces.ReadFromPointer(reader, faceList);
            }

            if (numNormals.Value > 0)
            {
                temp = new SR1_StructureArray <Normal>(numNormals.Value).SetPadding(4).ReadFromPointer(reader, normalList);

                // 2 mystery bytes after normalList. Always 0x2A and 0xCD.
                if (temp.End != 0x00000000 && !reader.File._Structures.ContainsKey(temp.End))
                {
                    reader.BaseStream.Position = temp.End;
                    new SR1_Primative <ushort>().Read(reader, null, "");

                    if (numFaces.Value <= 0)
                    {
                        new SR1_Primative <ushort>().Read(reader, null, "");
                    }
                }
            }

            new DrMoveAniTex().ReadFromPointer(reader, aniList);

            if (reader.File._Version <= SR1_File.Version.May12)
            {
                if (sbspRoot.Offset != 0 && sbspRoot.Offset < sbspStartLeaves.Offset)
                {
                    new SR1_StructureSeries <BSPNode>((int)(sbspStartLeaves.Offset - sbspRoot.Offset)).ReadFromPointer(reader, sbspRoot);
                }
            }

            StreamUnitPortalList portalList = new StreamUnitPortalList();

            portalList.ReadFromPointer(reader, StreamUnits);

            SR1_StructureSeries <TextureFT3> textures = new SR1_StructureSeries <TextureFT3>((int)(EndTextureList.Offset - StartTextureList.Offset));

            textures.ReadFromPointer(reader, StartTextureList);

            if (reader.File._Version <= SR1_File.Version.May12)
            {
                new SR1_StructureSeries <SBSPLeaf>((int)(sbspEndLeaves.Offset - sbspStartLeaves.Offset)).ReadFromPointer(reader, sbspStartLeaves);

                if (reader.IntroListDictionary.Count > 0)
                {
                    SR1_StructureList <SR1_PointerArray <Intro> > introListSet = new SR1_StructureList <SR1_PointerArray <Intro> >();

                    foreach (KeyValuePair <uint, SR1_PointerArray <Intro> > introList in reader.IntroListDictionary)
                    {
                        introListSet.Add(introList.Value);
                    }

                    introListSet.ReadFromPointer(reader, sbspEndLeaves);
                }
            }

            new SR1_StructureSeries <MorphVertex>((int)(MorphColorList.Offset - MorphDiffList.Offset)).ReadFromPointer(reader, MorphDiffList);

            int morphColorPadding = (reader.File._Version >= SR1_File.Version.May12) ? 4 : 2;

            new SR1_StructureArray <MorphColor>(numVertices.Value).SetPadding(morphColorPadding).ReadFromPointer(reader, MorphColorList);

            SR1_StructureArray <BSPTree> bspTrees = new SR1_StructureArray <BSPTree>(numBSPTrees.Value);

            bspTrees.ReadFromPointer(reader, BSPTreeArray);

            if (bspTrees.Count > 0 && faces.Count > 0)
            {
                BSPTree tree = (BSPTree)bspTrees[numBSPTrees.Value - 1];

                if (tree.ID.Value == -1 && tree.startLeaves.Offset != 0 &&
                    reader.File._Structures.ContainsKey(tree.startLeaves.Offset) &&
                    reader.Level.SignalListStart.Offset != 0 &&
                    reader.File._Structures.ContainsKey(reader.Level.SignalListStart.Offset))
                {
                    SR1_StructureSeries <BSPLeaf> leaves =
                        (SR1_StructureSeries <BSPLeaf>)reader.File._Structures[tree.startLeaves.Offset];
                    SR1_StructureSeries <MultiSignal> multiSignals =
                        (SR1_StructureSeries <MultiSignal>)reader.File._Structures[reader.Level.SignalListStart.Offset];

                    foreach (BSPLeaf leaf in leaves)
                    {
                        uint  faceIndex = (leaf.faceList.Offset - faces.Start) / 12;
                        short numFaces  = leaf.numFaces.Value;
                        for (short f = 0; f < numFaces; f++)
                        {
                            TFace tFace = (TFace)faces[(int)faceIndex + f];
                            tFace.IsInSignalGroup = true;

                            foreach (MultiSignal mSignal in multiSignals)
                            {
                                if (mSignal.Start == (signals.Offset + tFace.textoff.Value))
                                {
                                    tFace.MultiSignal = mSignal;
                                    if (mSignal.numSignals.Value > 0)
                                    {
                                        tFace.Signal = (Signal)mSignal.signalList[0];
                                    }
                                    break;
                                }
                            }

                            if (tFace.MultiSignal != null)
                            {
                                foreach (StreamUnitPortal portal in portalList.portals)
                                {
                                    if (portal.MSignalID.Value == tFace.MultiSignal.signalNum.Value)
                                    {
                                        tFace.Portal = portal;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            foreach (TFace face in faces)
            {
                if (!face.IsInSignalGroup)
                {
                    int textureSize  = (reader.File._Version >= SR1_File.Version.May12) ? 12 : 16;
                    int textureIndex = face.textoff.Value / textureSize;
                    if (textureIndex < textures.Count)
                    {
                        face.Texture = (TextureFT3)textures[textureIndex];
                    }
                }
            }

            new SR1_PrimativeArray <ushort>(numFaces.Value).SetPadding(4).ReadFromPointer(reader, morphNormalIdx);

            if (reader.File._Version == SR1_File.Version.Retail_PC)
            {
                new UnknownPCList().ReadFromPointer(reader, unknownPCList);
            }

            if (reader.Level.Name == "cathy28")
            {
                reader.BaseStream.Position = BSPTreeArray.Offset - 1;
                bool found = false;
                while (true)
                {
                    if (reader.File._Structures.ContainsKey((uint)reader.BaseStream.Position))
                    {
                        SR1_Structure structure = reader.File._Structures[(uint)reader.BaseStream.Position];
                        if (structure.GetType() == typeof(SR1_StructureSeries <BSPNode>))
                        {
                            found = true;
                        }
                        else if (structure.GetType() != typeof(SR1_StructureSeries <BSPLeaf>))
                        {
                            break;
                        }

                        if (found)
                        {
                            reader.BaseStream.Position = structure.End;
                            continue;
                        }
                    }

                    if (found)
                    {
                        new SR1_StructureArray <BSPLeaf>(1).Read(reader, null, "");
                        break;
                    }

                    reader.BaseStream.Position--;
                }
            }
        }
        public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags)
        {
            base.MigrateVersion(file, targetVersion, migrateFlags);

            if (file._Version <= SR1_File.Version.May12 && targetVersion >= SR1_File.Version.Retail_PC)
            {
                if (sbspRoot.Offset != 0)
                {
                    file._Structures.Remove(sbspRoot.Offset);
                    sbspRoot.Offset = 0;
                }

                if (sbspStartLeaves.Offset != 0)
                {
                    file._Structures.Remove(sbspStartLeaves.Offset);
                    sbspStartLeaves.Offset = 0;
                    sbspEndLeaves.Offset   = 0;
                }
            }

            if (file._Version < SR1_File.Version.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC)
            {
                if (aniList.Offset != 0)
                {
                    file._Structures.Remove(aniList.Offset);
                    aniList.Offset        = 0;
                    EndTextureList.Offset = MorphDiffList.Offset;
                }

                SR1_Structure lastStructure = file._Structures.Values[file._Structures.Count - 1];
                uint          position      = lastStructure.End;

                unknownPCList.Offset = position;
                UnknownPCList newUnknownPCList = new UnknownPCList();
                file._Structures.Add(position, newUnknownPCList);
                file._MigrationStructures.Add(position, newUnknownPCList);
            }

            if ((migrateFlags & SR1_File.MigrateFlags.ForceWaterTranslucent) != 0)
            {
                if (numFaces.Value > 0 && faceList.Offset != 0 && file._Structures.ContainsKey(faceList.Offset) &&
                    StartTextureList.Offset != 0 && file._Structures.ContainsKey(StartTextureList.Offset))
                {
                    SR1_Structure facesStruct    = file._Structures[faceList.Offset];
                    SR1_Structure texturesStruct = file._Structures[StartTextureList.Offset];

                    if (facesStruct.GetType() == typeof(SR1_StructureArray <TFace>) &&
                        texturesStruct.GetType() == typeof(SR1_StructureSeries <TextureFT3>))
                    {
                        SR1_StructureArray <TFace>       faces    = (SR1_StructureArray <TFace>)facesStruct;
                        SR1_StructureSeries <TextureFT3> textures = (SR1_StructureSeries <TextureFT3>)texturesStruct;
                        foreach (TFace face in faces)
                        {
                            if (!face.IsInSignalGroup && (face.attr.Value & 0x08) != 0)
                            {
                                int        textureSize = file._Version < SR1_File.Version.May12 ? 16 : 12;
                                TextureFT3 texture     = (TextureFT3)textures[face.textoff.Value / textureSize];
                                texture.attr.Value |= 0x0010;
                            }
                        }
                    }
                }
            }
        }
示例#15
0
        protected override void ReadMembers(SR1_Reader reader, SR1_Structure parent)
        {
            eventNumber.Read(reader, this, "eventNumber");
            numInstances.Read(reader, this, "numInstances");
            numActions.Read(reader, this, "numActions");
            processingPuppetShow.Read(reader, this, "processingPuppetShow");
            eventVariables.Read(reader, this, "eventVariables");
            instanceList.Read(reader, this, "instanceList");
            conditionalList.Read(reader, this, "conditionalList");
            actionList.Read(reader, this, "actionList");

            if (instanceList.Offset != 0 && numInstances.Value > 0)
            {
                instancePointers = new SR1_PointerArray <EventBasicObject>(numInstances.Value, false);
                instancePointers.Read(reader, this, "instancePonters");
            }

            int tempNumConditions = 0;
            int tempNumActions    = 0;

            if (numActions.Value > 0)
            {
                if (conditionalList.Offset != 0)
                {
                    conditionalPointers = new SR1_PointerArray <ScriptPCode>(numActions.Value, false);
                    conditionalPointers.Read(reader, this, "conditionalPointers");
                    foreach (SR1_PointerBase pointer in conditionalPointers)
                    {
                        if (pointer.Offset != 0)
                        {
                            tempNumConditions++;
                        }
                    }
                }

                if (actionList.Offset != 0)
                {
                    actionPointers = new SR1_PointerArray <ScriptPCode>(numActions.Value, false);
                    actionPointers.Read(reader, this, "actionPointers");
                    foreach (SR1_PointerBase pointer in actionPointers)
                    {
                        if (pointer.Offset != 0)
                        {
                            tempNumActions++;
                        }
                    }
                }
            }

            if (instanceList.Offset != 0 && numInstances.Value > 0)
            {
                instances = new SR1_StructureArray <EventBasicObject>(numInstances.Value);
                instances.Read(reader, this, "instances");
            }

            if (tempNumConditions > 0)
            {
                conditionals = new SR1_StructureArray <ScriptPCode>(tempNumConditions);
                conditionals.Read(reader, this, "conditionals");
            }

            if (tempNumActions > 0)
            {
                actions = new SR1_StructureArray <ScriptPCode>(tempNumActions);
                actions.Read(reader, this, "actions");
            }
        }
示例#16
0
        protected override void ReadReferences(SR1_Reader reader, SR1_Structure parent)
        {
            nameString.SetPadding(4).ReadFromPointer(reader, name);
            scriptString.SetPadding(4).ReadFromPointer(reader, script);

            Name = scriptString.ToString();

            bool useFlameGSHack = false;

            if (reader.File._Version == SR1_File.Version.Feb16 && Name == "flamegs_")
            {
                new SR1_String(12).SetPadding(4).ReadOrphan(reader, 0x44);
                useFlameGSHack = true;
            }

            SR1_Structure modelListStruct   = new SR1_PointerArray <Model>(System.Math.Max(1, (int)numModels.Value), true).ReadFromPointer(reader, modelList);
            SR1_Structure animListStruct    = new SR1_PointerArray <G2AnimKeylist_Type>(numAnims.Value, false).ReadFromPointer(reader, animList);
            SR1_Structure effectListStruct  = new SR1_StructureArray <ObjectEffect>(numberOfEffects.Value).ReadFromPointer(reader, effectList);
            SR1_Structure soundDataStruct   = new SFXFileData().SetPadding(4).ReadFromPointer(reader, soundData);
            SR1_Structure relocListStruct   = new RelocateList().ReadFromPointer(reader, relocList);
            SR1_Structure relocModuleStruct =
                (Name == "cinemax_") ? new CinemaFnTableT().ReadFromPointer(reader, relocModule) :
                (Name == "mcardx__") ? new MCardMTableT().ReadFromPointer(reader, relocModule) :
                new MonsterFunctionTable().ReadFromPointer(reader, relocModule);

            PhysObProperties     physObBase    = null;
            PhysObPropertiesBase physOb        = null;
            MonsterAttributes    monAttributes = null;

            if (data.Offset != 0)
            {
                if (Name == "pshblkb_" || Name == "urn_____")
                {
                    new PhysObGenericProperties(0).ReadFromPointer(reader, data);
                }
                else if ((oflags2.Value & 0x00040000) != 0 ||
                         Name == "catdora_" ||
                         Name == "walbosc_" ||
                         Name == "flamesk_" ||
                         Name == "flamesl_")
                {
                    // new PhysObProperties().ReadFromPointer(reader, data);

                    reader.BaseStream.Position = (long)data.Offset;
                    physObBase = new PhysObProperties();
                    physObBase.ReadTemp(reader);
                    reader.BaseStream.Position = (long)data.Offset;
                    physOb = (PhysObPropertiesBase)physObBase.CreateReplacementObject();
                    physOb.ReadFromPointer(reader, data);
                    reader.PhysObProperties = physOb;
                }
                else if ((oflags2.Value & 0x00080000) != 0)
                {
                    //_MonsterAttributes
                    // monsterAttributes->magic number: -0x531fff9b
                    // MONTABLE_SetupTablePointer whatAmI

                    monAttributes = new MonsterAttributes();
                    monAttributes.ReadFromPointer(reader, data);

                    if (Name == "aluka___")
                    {
                        new AlukaTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "alukabss")
                    {
                        new AlukaBssTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "hunter__")
                    {
                        new HunterTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "kain____")
                    {
                        KainTuneData kainData = new KainTuneData();
                        kainData.SetPadding(soundData.Offset != 0 ? 0 : 4);
                        kainData.ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "roninbss")
                    {
                        new RoninBssTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "skinbos_")
                    {
                        new SkinBosTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "walboss_")
                    {
                        new WalBosTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "walbosb_")
                    {
                        new WalBosBTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "wallcr__")
                    {
                        new WallcrData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "vwraith_")
                    {
                        new VWraithTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                    else if (Name == "priests_")
                    {
                        new PriestsTuneData().ReadFromPointer(reader, monAttributes.tunData);
                    }
                }
                else if (Name == "raziel__")
                {
                    new RazielData().ReadFromPointer(reader, data);
                }
                else if (Name == "sreavr__")
                {
                    new ReaverTuneData().ReadFromPointer(reader, data);
                }
                else if (Name == "glphicon")
                {
                    new GlyphTuneData().ReadFromPointer(reader, data);
                }
                else if (Name == "monster_")
                {
                    new MonsterAttributes().ReadFromPointer(reader, data);
                }
                else if (Name == "particle")
                {
                    // GenericFXObject?
                    // See FX_RelocateGeneric?
                    new GenericFXObject().ReadFromPointer(reader, data);
                }
                else if (Name == "litshaft")
                {
                    new LitShaftProperties().ReadFromPointer(reader, data);
                }
                else if (Name == "waterfx_")
                {
                    new WaterFXProperties().ReadFromPointer(reader, data);
                }
                else if ((oflags2.Value & 0x00040000) == 0)
                {
                    new GenericTune().ReadFromPointer(reader, data);
                }
            }

            if (numAnims.Value > 0)
            {
                SR1_StructureArray <G2AnimKeylist_Type> keyLists = new SR1_StructureArray <G2AnimKeylist_Type>(numAnims.Value);
                if (reader.File._Version >= SR1_File.Version.Feb16 && reader.File._Version < SR1_File.Version.May12 &&
                    Name == "wrshp___")
                {
                    ((G2AnimKeylist_Type)keyLists[14]).OverridePadLength(8);
                }
                if (reader.File._Version >= SR1_File.Version.May12 && reader.File._Version < SR1_File.Version.Jun01 &&
                    Name == "wrshp___")
                {
                    ((G2AnimKeylist_Type)keyLists[15]).OverridePadLength(8);
                }
                else if (reader.File._Version >= SR1_File.Version.Jun01 && reader.File._Version < SR1_File.Version.Next &&
                         Name == "wrshp___")
                {
                    ((G2AnimKeylist_Type)keyLists[13]).OverridePadLength(8);
                }

                keyLists.ReadFromPointer(reader, ((SR1_PointerArray <G2AnimKeylist_Type>)animListStruct)[0]);
                AnimKeyListStart = keyLists.Start;

                bool readUnusedAnimFX = false;

                if (reader.File._Version >= SR1_File.Version.May12 && reader.File._Version < SR1_File.Version.Jul14 &&
                    (Name == "hunter__" || Name == "wrshp___" ||
                     Name == "vlgra___" || Name == "vlgrb___" || Name == "vlgrc___"))
                {
                    readUnusedAnimFX = true;
                }
                else if (reader.File._Version == SR1_File.Version.Feb16)
                {
                    readUnusedAnimFX = true;
                }

                if (readUnusedAnimFX)
                {
                    reader.BaseStream.Position = keyLists.Start - 1;
                    while (!reader.File._Structures.ContainsKey((uint)reader.BaseStream.Position))
                    {
                        reader.BaseStream.Position--;
                    }
                    reader.BaseStream.Position = reader.File._Structures[(uint)reader.BaseStream.Position].End;
                    uint length = keyLists.Start - (uint)reader.BaseStream.Position;
                    if (length > 0)
                    {
                        new SR1_StructureSeries <G2AnimFXList>((int)length).SetPadding(4).Read(reader, null, "");
                    }
                }
                else if (reader.AnimFXDictionary.Count > 0)
                {
                    // Superceeded by code above?
                    int numEffects = reader.AnimFXDictionary.Count;
                    if (reader.Object.Name == "wrshp___")
                    {
                        if (reader.File._Version >= SR1_File.Version.Jul14)
                        {
                            numEffects = 11;
                        }
                        else if (reader.File._Version >= SR1_File.Version.Jun18)
                        {
                            numEffects = 28;
                        }
                    }

                    SR1_StructureArray <G2AnimFXList> fxLists = new SR1_StructureArray <G2AnimFXList>(numEffects);
                    fxLists.SetPadding(4).ReadFromPointer(reader, reader.AnimFXDictionary.Values[0]);
                }
            }

            uint padAdress = End;

            if (nameString.End > padAdress)
            {
                padAdress = nameString.End;
            }
            if (scriptString.End > padAdress)
            {
                padAdress = scriptString.End;
            }
            if (modelListStruct.End > padAdress)
            {
                padAdress = modelListStruct.End;
            }
            if (animListStruct.End > padAdress)
            {
                padAdress = animListStruct.End;
            }
            if (effectListStruct.End > padAdress)
            {
                padAdress = effectListStruct.End;
            }

            // 8 mystery bytes after effectList. THIS APPEARS TO BE A PHYSOBLIGHT. REMOVE THIS?
            if (physObBase != null && !reader.File._Structures.ContainsKey(padAdress))
            {
                reader.BaseStream.Position = padAdress;
                new SR1_PrimativeArray <byte>(useFlameGSHack ? 4 : 8).Read(reader, null, "");
            }
        }