public void ExportToList(JazzStateMachine.AnimationList animList, IDictionary<ulong, string> nameMap, bool exportAllNames) { if (animList == null) { throw new ArgumentNullException("animList"); } if (nameMap == null) { throw new ArgumentNullException("nameMap"); } string srcFile; foreach (KeyValuePair<string, SortedDictionary<string, ActorDefinition>> dict in this.mSrcFile2Ns2Actor) { srcFile = dict.Key; foreach (KeyValuePair<string, ActorDefinition> pair in dict.Value) { animList.Add(this.ExportEntry(srcFile, pair.Key, pair.Value, nameMap, exportAllNames)); } } ulong iid; uint code; SortedDictionary<string, ActorDefinition> table; foreach (KeyValuePair<RK, string> key in this.mKeyToFilenameMap) { iid = key.Key.IID; srcFile = key.Value; code = (uint)((iid >> 0x20) ^ (iid & 0xffffffff)); if (this.mSrcFile2Ns2Actor.TryGetValue(srcFile, out table)) { foreach (KeyValuePair<string, ActorDefinition> pair in table) { animList.Add(this.ExportEntry(code, pair.Key, pair.Value, nameMap, exportAllNames)); } } } }
public override GenericRCOLResource.ChunkEntry Export( IDictionary<ulong, string> nameMap, bool exportAllNames) { if (nameMap == null) { throw new ArgumentNullException("nameMap"); } System.IO.Stream s = null; TGIBlock tgi = new TGIBlock(0, null, "ITG", ResourceType, 0, this.mInstanceId); JazzStateMachine jsm = new JazzStateMachine(0, null, s); jsm.NameHash = this.mNameHash; if (!this.bNameIsHash && nameMap != null && !nameMap.ContainsKey(this.mNameHash) && (exportAllNames || !KeyNameReg.HasName(this.mNameHash))) { nameMap[this.mNameHash] = this.mName; } ActorDefinition[] ads = this.mActorDefinitions.ToArray(); Array.Sort(ads, 0, ads.Length, ActorDefinition.NameComparer.Instance); JazzChunk.ChunkReferenceList actorList = jsm.ActorDefinitionIndexes; foreach (ActorDefinition ad in ads) { actorList.Add(ad == null ? NullCRef : ad.ChunkReference); } ParamDefinition[] pds = this.mParamDefinitions.ToArray(); Array.Sort(pds, 0, pds.Length, ParamDefinition.NameComparer.Instance); JazzChunk.ChunkReferenceList paramList = jsm.PropertyDefinitionIndexes; foreach (ParamDefinition pd in pds) { paramList.Add(pd == null ? NullCRef : pd.ChunkReference); } State[] states = this.mStates.ToArray(); Array.Sort(states, 0, states.Length, State.NameComparer.Instance); JazzChunk.ChunkReferenceList stateList = jsm.StateIndexes; foreach (State state in states) { stateList.Add( state == null ? NullCRef : state.ChunkReference); } uint hash; string name; ulong clipIID; NamespaceMap.AnimSource[] sources = this.mNamespaceMap.GetSourceToNamespaceToActorArray(); for (int i = 0; i < sources.Length; i++) { name = sources[i].FileName; if (!name.StartsWith("0x") || !uint.TryParse(name.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out hash)) { clipIID = FNVHash.HashString64(name); if (!nameMap.ContainsKey(clipIID)) { nameMap[clipIID] = name; } } } this.mNamespaceMap.UpdateKeyToFilenameMap(nameMap); this.mNamespaceMap.ExportToList(jsm.Animations, nameMap, exportAllNames); jsm.Properties = this.mFlags; jsm.AutomationPriority = this.mDefaultPriority; jsm.AwarenessOverlayLevel = this.mAwarenessOverlayLevel; return new GenericRCOLResource.ChunkEntry(0, null, tgi, jsm); }
public void SetFlags(JazzStateMachine.Flags flags, bool value) { if (value) { this.mFlags |= flags; } else { this.mFlags &= ~flags; } }