public virtual void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { foreach (SR1_Structure structure in MembersRead) { structure.MigrateVersion(file, targetVersion, migrateFlags); } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); int newNumSignals = 0; while (newNumSignals < signalList.Count) { if (((Signal)signalList[newNumSignals]).OmitFromMigration) { signalList.RemoveAt(newNumSignals); } else { newNumSignals++; } } numSignals.Value = newNumSignals; if (file._Version < SR1_File.Version.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { pad.Value = 15; } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { int textureID = file._Overrides.NewTextureIDs[tpage.Value & 0x00000007]; tpage.Value = (ushort)textureID; attr2.Value = 0x0108; if (file._Version < SR1_File.Version.May12) { if ((attr.Value & 0x0010) != 0) { tpage.Value |= 0x4000; attr2.Value |= 0x0060; } } else { if ((attr.Value & 0x0040) != 0) { tpage.Value |= 0x4000; attr2.Value |= 0x0060; } } //attr.Value &= ~0x0040; } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { for (int i = 0; i < _List.Count;) { string objectName = _List[i].ToString(); if (objectName == "Shadow" || objectName == "Shadow2" || objectName == "Shadow3") { _List.Remove(_List[i]); } else { if (file._Overrides.NewObjectNames.ContainsKey(_List[i].ToString())) { _List[i].SetText(file._Overrides.NewObjectNames[_List[i].ToString()], 16); } i++; } } file._MigrationStructures.Add(Start, this); } for (int i = 0; i < _List.Count; i++) { file._ObjectNames.Add(_List[i].ToString()); } }
public void Write(SR1_Writer writer, SR1_File.Version versionAdded, SR1_File.Version versionRemoved) { if (writer.File._Version >= versionAdded && writer.File._Version < versionRemoved) { Write(writer); } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); if (file._Version != targetVersion) { if (file._Overrides.NewName != null) { nameString.SetText(file._Overrides.NewName, 12); scriptString.SetText(file._Overrides.NewName, 12); } } if (file._Version < SR1_File.Version.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { //oflags.Value = 0x280042F1; //oflags2.Value = 0x06E80004; if (relocList.Offset != 0) { file._Structures.Remove(relocList.Offset); relocList.Offset = 0; } if (relocModule.Offset != 0) { file._Structures.Remove(relocModule.Offset); relocModule.Offset = 0; } } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); if ((migrateFlags & SR1_File.MigrateFlags.RemovePortals) != 0) { OmitFromMigration = true; } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { int textureID = file._Overrides.NewTextureIDs[tpage.Value & 0x00000007]; tpage.Value = (ushort)textureID; pad.Value = 264; } }
public void Read(SR1_Reader reader, SR1_Structure parent, string name, SR1_File.Version versionAdded, SR1_File.Version versionRemoved) { if (reader.File._Version >= versionAdded && reader.File._Version < versionRemoved) { Read(reader, parent, name); } else { Parent = parent; Name = name; } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { foreach (SR1_PointerBase aniTexDestInfoPointer in aniTexInfo) { file._Structures.Remove(aniTexDestInfoPointer.Offset); } } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { if (aniTextures.Offset != 0) { file._Structures.Remove(aniTextures.Offset); aniTextures.Offset = 0; } } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { // Burn in sunlight. // The 0x0040 seems right, but not sure about the 0x0002. if ((flags.Value & 0x0002) != 0) { flags.Value |= 0x0040; } } }
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.Jun01) { if (introList.Offset != 0) { file._Structures.Remove(introList.Offset); } if (lightList.Offset != 0) { file._Structures.Remove(lightList.Offset); } } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); if (file._Version != targetVersion) { if (file._Overrides.NewIntroIDs != null) { UniqueID.Value = file._Overrides.NewIntroIDs[file._Overrides.NextIntroID]; file._Overrides.NextIntroID++; } if (file._Overrides.NewObjectNames.ContainsKey(name.ToString())) { name.SetText(file._Overrides.NewObjectNames[name.ToString()], 16); } } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); if (file._Version != targetVersion) { if (command.Value == 0x1A && parameter.Count >= 1 && file._IntroIDs != null && file._Overrides.NewIntroIDs != null) { for (int i = 0; i < file._IntroIDs.Count; i++) { if (file._IntroIDs[i] == parameter[i]) { parameter[i] = file._Overrides.NewIntroIDs[i]; break; } } } } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); bool removeSignal = false; if (file._Version < SR1_File.Version.May12 && targetVersion >= SR1_File.Version.May12) { if (IsInSignalGroup) { // Looks like there are other things triggered besides portals/signals. removeSignal |= (attr.Value != 0x44); } else { // 0x02 lets forge 6 work and prevents crashing in retreat when using portals. // 0x08 is water? // 0x46 lets portals work but not fully, however crashes forge 5. // attr.Value = (byte)(attr.Value & 0x46); textoff.Value = (ushort)((textoff.Value * 12) / 16); //attr.Value = (byte)(attr.Value & 0x02); // 0x44 is used for signals. Renderable stuff too? } } if (IsInSignalGroup) { removeSignal |= Portal != null && Portal.OmitFromMigration; removeSignal |= MultiSignal != null && MultiSignal.OmitFromMigration; removeSignal |= Signal != null && Signal.OmitFromMigration; // 0x004ABBBA has something to do with the portals. // COLLIDE_LineWithSignals does care about TFace::texoff. See address 00490DF6 in game. // It's an offset into Terrain->signals, not Level->signalListStart if (removeSignal) { attr.Value = 0; textoff.Value = 0; } } }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { magicnum.Value = 0xACE00065; //whatAmI.Value = 66; if (tunData.Offset != 0) { file._Structures.Remove(tunData.Offset); tunData.Offset = 0; } /*if (numBehaviors.Value == 0) * { * numBehaviors.Value = 2; * * SR1_Structure lastStructure = file._Structures.Values[file._Structures.Count - 1]; * uint position = lastStructure.End; * * behaviorList.Offset = position; * MonsterBehavior newBehaviors = new MonsterBehavior(); * newBehaviors.alertness.Value = 3; * newBehaviors.idleFreq.Value = 0; * newBehaviors.numIdles.Value = 0; * newBehaviors.idleList[0] = -1; * newBehaviors.idleList[1] = -1; * newBehaviors.idleList[2] = -1; * newBehaviors.idleList[3] = -1; * newBehaviors.idleList[4] = -1; * file._Structures.Add(position, newBehaviors); * file._MigrationStructures.Add(position, newBehaviors); * }*/ } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); int newNumPortals = 0; while (newNumPortals < portals.Count) { if (((StreamUnitPortal)portals[newNumPortals]).OmitFromMigration) { portals.RemoveAt(newNumPortals); } else { newNumPortals++; } } /*Level level = (Level)file._Structures[0]; * if (level.Name == "city12") * { * StreamUnitPortal newPortalA = new StreamUnitPortal(); * newPortalA.tolevelname.SetReadMax(true); * newPortalA.tolevelname.SetText("city11,2", 16); * newPortalA.streamID.Value = 154; * newPortalA.MSignalID.Value = 1; * newPortalA.minx.Value = 2686; * newPortalA.miny.Value = 2086; * newPortalA.minz.Value = -10878; * newPortalA.maxx.Value = 3672; * newPortalA.maxy.Value = 3611; * newPortalA.maxz.Value = -9147; * ((SVector)newPortalA.t1[0]).SetValues(2686, 2086, -10696); // Face 149 * ((SVector)newPortalA.t1[1]).SetValues(3672, 3611, -9329); // Face 150 * ((SVector)newPortalA.t1[2]).SetValues(3152, 2086, -9147); // Face 151 * ((SVector)newPortalA.t2[0]).SetValues(2686, 2086, -10696); // Face 149 * ((SVector)newPortalA.t2[1]).SetValues(3206, 3611, -10878); // Face 152 * ((SVector)newPortalA.t2[2]).SetValues(3672, 3611, -9329); // Face 150 * portals.Add(newPortalA); * newNumPortals++; * * StreamUnitPortal newPortalB = new StreamUnitPortal(); * newPortalB.tolevelname.SetReadMax(true); * newPortalB.tolevelname.SetText("city16,97", 16); * newPortalB.streamID.Value = 215; * newPortalB.MSignalID.Value = 98; * newPortalB.minx.Value = 10879; * newPortalB.miny.Value = -1396; * newPortalB.minz.Value = -14072; * newPortalB.maxx.Value = 10880; * newPortalB.maxy.Value = 1163; * newPortalB.maxz.Value = -12792; * ((SVector)newPortalB.t1[0]).SetValues(10880, 1163, -12792); // Face 153 * ((SVector)newPortalB.t1[1]).SetValues(10880, 1163, -14072); // Face 136 * ((SVector)newPortalB.t1[2]).SetValues(10879, -1396, -14072); // Face 148 * ((SVector)newPortalB.t2[0]).SetValues(10879, -1396, -14072); // Face 148 * ((SVector)newPortalB.t2[1]).SetValues(10879, -1396, -12792); // Face 154 * ((SVector)newPortalB.t2[2]).SetValues(10880, 1163, -12792); // Face 153 * portals.Add(newPortalB); * newNumPortals++; * }*/ numPortals.Value = newNumPortals; }
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; } } } } } }
public override void MigrateVersion(SR1_File file, SR1_File.Version targetVersion, SR1_File.MigrateFlags migrateFlags) { base.MigrateVersion(file, targetVersion, migrateFlags); if (file._Version != targetVersion) { if (file._Overrides.NewName != null) { worldNameString.SetText(file._Overrides.NewName, 12); } if (file._Overrides.NewStreamUnitID != 0) { streamUnitID.Value = file._Overrides.NewStreamUnitID; } } if (file._Version < SR1_File.Version.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { versionNumber.Value = SR1_File.RETAIL_VERSION; fogFar.Value = 20000; fogNear.Value = 19999; spectralFogFar.Value = 20000; spectralFogNear.Value = 19999; waterFogFar.Value = 20000; waterFogNear.Value = 19999; vramSize.x.Value = -1; vramSize.y.Value = -1; vramSize.w.Value = -1; vramSize.h.Value = -1; holdFogFar.Value = 20000; holdFogNear.Value = 19999; TODfogNearFar[0] = 19999; TODfogNearFar[1] = 20000; TODfogNearFar[2] = 19999; TODfogNearFar[3] = 20000; TODfogNearFar[4] = 19999; TODfogNearFar[5] = 20000; TODfogNearFar[6] = 19999; TODfogNearFar[7] = 20000; if (SFXMarkerList.Offset != 0) { file._Structures.Remove(SFXMarkerList.Offset); NumberOfSFXMarkers.Value = 0; SFXMarkerList.Offset = 0; } if (lightListStruct1.Start != 0) { file._Structures.Remove(lightListStruct1.Start); } if (push6Padding.Start != 0) { file._Structures.Remove(push6Padding.Start); } if (depthQPTable.Offset != 0) { file._Structures.Remove(depthQPTable.Offset); } if (bgAniList.Offset != 0) { file._Structures.Remove(bgAniList.Offset); bgAniList.Offset = 0; } if ((migrateFlags & SR1_File.MigrateFlags.RemoveEvents) != 0) { // Can't use SignalListStart because I included data before that in the Events structure. if (events.Start != 0) { file._Structures.Remove(events.Start); PuzzleInstances.Offset = 0; SignalListEnd.Offset = events.End; } } if ((migrateFlags & SR1_File.MigrateFlags.RemoveVertexMorphs) != 0) { numVMObjects.Value = 0; if (vmobjectList.Offset != 0) { file._Structures.Remove(vmobjectList.Offset); vmobjectList.Offset = 0; } } } if (file._Version <= SR1_File.Version.Feb16 && targetVersion >= SR1_File.Version.Retail_PC) { if (Name == "undrct20" || Name == "undrct2") { unitFlags.Value = 0; } } /*if (Name == "city12") * { * SR1_StructureSeries<MultiSignal> multiSignals = * (SR1_StructureSeries<MultiSignal>)file._Structures[SignalListStart.Offset]; * * MultiSignal multiSignalA = (MultiSignal)multiSignals[0]; * Signal signalA = new Signal(); * SignalStreamLevel signalStreamLevelA = new SignalStreamLevel(); * signalStreamLevelA.currentnum.Value = multiSignalA.signalNum.Value; * signalStreamLevelA.toname.SetReadMax(true); * signalStreamLevelA.toname.SetText("city11,2", 16); * signalStreamLevelA.streamID.Value = 154; * signalA.data = signalStreamLevelA; * signalA.id.Value = (int)Signal.SignalTypeJun01.HandleStreamLevel; * multiSignalA.signalList.Add(signalA); * * MultiSignal multiSignalB = (MultiSignal)multiSignals[1]; * Signal signalB = new Signal(); * SignalStreamLevel signalStreamLevelB = new SignalStreamLevel(); * signalStreamLevelB.currentnum.Value = multiSignalB.signalNum.Value; * signalStreamLevelB.toname.SetText("city16,97", 16); * signalStreamLevelB.streamID.Value = 215; * signalB.data = signalStreamLevelB; * signalB.id.Value = (int)Signal.SignalTypeJun01.HandleStreamLevel; * multiSignalB.signalList.Add(signalB); * }*/ }
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.Retail_PC && targetVersion >= SR1_File.Version.Retail_PC) { int newID = -1; switch ((SignalTypeFeb16)id.Value) { case SignalTypeFeb16.HandleLightGroup: newID = (int)SignalTypeJun01.HandleLightGroup; break; case SignalTypeFeb16.HandleCameraAdjust: newID = (int)SignalTypeJun01.HandleCameraAdjust; break; case SignalTypeFeb16.HandleCameraMode: newID = (int)SignalTypeJun01.HandleCameraMode; break; case SignalTypeFeb16.HandleCameraKey: newID = (int)SignalTypeJun01.HandleCameraKey; break; case SignalTypeFeb16.HandleCameraTimer: newID = (int)SignalTypeJun01.HandleCameraTimer; break; case SignalTypeFeb16.HandleCameraSmooth: newID = (int)SignalTypeJun01.HandleCameraSmooth; break; case SignalTypeFeb16.HandleCameraValue: newID = (int)SignalTypeJun01.HandleCameraValue; break; case SignalTypeFeb16.HandleCameraLock: newID = (int)SignalTypeJun01.HandleCameraLock; break; case SignalTypeFeb16.HandleCameraUnlock: newID = (int)SignalTypeJun01.HandleCameraUnlock; break; case SignalTypeFeb16.HandleCameraSave: newID = (int)SignalTypeJun01.HandleCameraSave; break; case SignalTypeFeb16.HandleCameraRestore: newID = (int)SignalTypeJun01.HandleCameraRestore; break; case SignalTypeFeb16.HandleFogNear: newID = (int)SignalTypeJun01.HandleFogNear; break; case SignalTypeFeb16.HandleFogFar: newID = (int)SignalTypeJun01.HandleFogFar; break; case SignalTypeFeb16.HandleCameraShake: newID = (int)SignalTypeJun01.HandleCameraShake; break; case SignalTypeFeb16.HandleCallSignal: newID = (int)SignalTypeJun01.HandleCallSignal; break; case SignalTypeFeb16.HandleEnd: newID = (int)SignalTypeJun01.HandleEnd; break; case SignalTypeFeb16.HandleStopPlayerControl: newID = (int)SignalTypeJun01.HandleStopPlayerControl; break; case SignalTypeFeb16.HandleStartPlayerControl: newID = (int)SignalTypeJun01.HandleStartPlayerControl; break; case SignalTypeFeb16.HandleStreamLevel: newID = (int)SignalTypeJun01.HandleStreamLevel; break; case SignalTypeFeb16.HandleCameraSpline: newID = (int)SignalTypeJun01.HandleCameraSpline; break; case SignalTypeFeb16.HandleScreenWipe: newID = (int)SignalTypeJun01.HandleScreenWipe; break; case SignalTypeFeb16.HandleBlendStart: newID = (int)SignalTypeJun01.HandleBlendStart; break; case SignalTypeFeb16.HandleScreenWipeColor: newID = (int)SignalTypeJun01.HandleScreenWipeColor; break; case SignalTypeFeb16.HandleSetSlideAngle: newID = (int)SignalTypeJun01.HandleSetSlideAngle; break; case SignalTypeFeb16.HandleResetSlideAngle: newID = (int)SignalTypeJun01.HandleResetSlideAngle; break; case SignalTypeFeb16.HandleSetCameraTilt: newID = (int)SignalTypeJun01.HandleSetCameraTilt; break; case SignalTypeFeb16.HandleSetCameraDistance: newID = (int)SignalTypeJun01.HandleSetCameraDistance; break; } id.Value = newID; if ((migrateFlags & SR1_File.MigrateFlags.RemoveSignals) != 0 || id.Value < 0) { OmitFromMigration = true; } } }