Example #1
0
 public CreatePropNode()
     : base(ResourceType, ResourceTag)
 {
     this.mPropActor = null;
     this.mPropParam = null;
     this.mPropKey   = new RK();
 }
Example #2
0
 private JazzStateMachine.Animation ExportEntry(uint code,
                                                string nameSpace, ActorDefinition actor,
                                                IDictionary <ulong, string> nameMap, bool exportAllNames)
 {
     return(this.ExportEntry(null, code, false,
                             nameSpace, actor, nameMap, exportAllNames));
 }
Example #3
0
        public override GenericRCOLResource.ChunkEntry Export(
            IDictionary <ulong, string> nameMap, bool exportAllNames)
        {
            System.IO.Stream s = null;
            TGIBlock         tgi
                = new TGIBlock(0, null, "ITG", ResourceType, 0, 0);
            JazzStopAnimationNode jsan
                = new JazzStopAnimationNode(0, null, s);

            jsan.AnimationFlags     = this.Flags;
            jsan.AnimationPriority1 = this.Priority;
            jsan.BlendInTime        = this.BlendInTime;
            jsan.BlendOutTime       = this.BlendOutTime;
            jsan.Speed = this.Speed;
            ActorDefinition actor = this.Actor;

            jsan.ActorDefinitionIndex = actor == null
                ? NullCRef : actor.ChunkReference;
            jsan.TimingPriority = this.TimingPriority;
            if (this.TargetCount > 0)
            {
                JazzChunk.ChunkReferenceList dgi     = jsan.DecisionGraphIndexes;
                DecisionGraphNode[]          targets = this.Targets;
                Array.Sort(targets, 0, targets.Length,
                           AChunkObject.InstantiationComparer.Instance);
                for (int i = 0; i < targets.Length; i++)
                {
                    dgi.Add(targets[i] == null
                        ? NullCRef : targets[i].ChunkReference);
                }
            }
            return(new GenericRCOLResource.ChunkEntry(0, null, tgi, jsan));
        }
Example #4
0
 private JazzStateMachine.Animation ExportEntry(string sourceFile,
                                                string nameSpace, ActorDefinition actor,
                                                IDictionary <ulong, string> nameMap, bool exportAllNames)
 {
     return(this.ExportEntry(sourceFile, 0, true,
                             nameSpace, actor, nameMap, exportAllNames));
 }
Example #5
0
 public ActorOperationNode(
     JazzActorOperationNode.ActorOperation operation)
     : base(ResourceType, ResourceTag)
 {
     this.mActor     = null;
     this.mOperation = operation;
     this.mOperand   = 0;
 }
Example #6
0
        private JazzStateMachine.Animation ExportEntry(
            string sourceFile, uint code, bool useSourceFile,
            string nameSpace, ActorDefinition actor,
            IDictionary <ulong, string> nameMap, bool ean)
        {
            System.IO.Stream s = null;
            uint             hash;
            string           name;

            JazzStateMachine.Animation animation
                = new JazzStateMachine.Animation(0, null, s);
            if (useSourceFile)
            {
                // TODO: sourceFile should not allow parsable numbers
                // Try to create a better brute force unhasher for
                // reading animation source files.
                if (!sourceFile.StartsWith("0x") ||
                    !uint.TryParse(sourceFile.Substring(2),
                                   System.Globalization.NumberStyles.HexNumber,
                                   null, out hash))
                {
                    hash = FNVHash.HashString32(sourceFile);
                    if (!nameMap.TryGetValue(hash, out name) &&
                        (ean || !KeyNameReg.TryFindName(hash, out name)))
                    {
                        nameMap[hash] = sourceFile;
                    }
                }
                animation.NameHash = hash;
            }
            else
            {
                animation.NameHash = code;
            }
            if (nameSpace.StartsWith("0x") &&
                uint.TryParse(nameSpace.Substring(2),
                              System.Globalization.NumberStyles.HexNumber,
                              null, out hash))
            {
                animation.Actor1Hash = hash;
            }
            else
            {
                hash = FNVHash.HashString32(nameSpace);
                if (!nameMap.TryGetValue(hash, out name) &&
                    (ean || !KeyNameReg.TryFindName(hash, out name)))
                {
                    nameMap[hash] = sourceFile;
                }
                animation.Actor1Hash = hash;
            }

            animation.Actor2Hash = actor == null ? 0 : actor.NameHash;

            return(animation);
        }
Example #7
0
 public AnimationNode(uint nodeType, string nodeTag)
     : base(nodeType, nodeTag)
 {
     this.mFlags          = JazzAnimationFlags.Default;
     this.mPriority       = JazzChunk.AnimationPriority.Unset;
     this.mBlendInTime    = 0;
     this.mBlendOutTime   = 0;
     this.mSpeed          = 1;
     this.mActor          = null;
     this.mTimingPriority = JazzChunk.AnimationPriority.Unset;
 }
Example #8
0
        public void SetNamespaceMap(string sourceFile, string nameSpace,
                                    ActorDefinition actor)
        {
            if (sourceFile == null)
            {
                throw new ArgumentNullException("sourceFile");
            }
            if (nameSpace == null)
            {
                throw new ArgumentNullException("namespaces");
            }
            SortedDictionary <string, ActorDefinition> dict;

            if (!this.mSrcFile2Ns2Actor.TryGetValue(sourceFile, out dict))
            {
                dict = new SortedDictionary <string, ActorDefinition>();
                this.mSrcFile2Ns2Actor.Add(sourceFile, dict);
            }
            dict[nameSpace] = actor;
        }
        public override GenericRCOLResource.ChunkEntry Export(
            IDictionary <ulong, string> nameMap, bool exportAllNames)
        {
            System.IO.Stream s = null;
            int      i;
            TGIBlock tgi
                = new TGIBlock(0, null, "ITG", ResourceType, 0, 0);
            JazzPlayAnimationNode jpan
                = new JazzPlayAnimationNode(0, null, s);

            jpan.ClipResource = string.IsNullOrEmpty(this.mClipPattern)
                ? this.mClipKey : DummyKey;
            jpan.TkmkResource = this.mTrackMaskKey;
            if (this.mSlotSetup.ActorSlotCount > 0)
            {
                JazzPlayAnimationNode.ActorSlot     jslot;
                JazzPlayAnimationNode.ActorSlotList jslots
                    = jpan.ActorSlots;
                SlotSetupBuilder.ActorSlot   slot;
                SlotSetupBuilder.ActorSlot[] slots
                    = this.mSlotSetup.ActorSlotArray;
                for (i = 0; i < slots.Length; i++)
                {
                    slot  = slots[i];
                    jslot = new JazzPlayAnimationNode.ActorSlot(0, null,
                                                                slot.ChainId, slot.SlotId,
                                                                slot.ActorNameHash, slot.SlotNameHash);
                    jslots.Add(jslot);
                }
            }
            if (this.mSlotSetup.ActorSuffixCount > 0)
            {
                JazzPlayAnimationNode.ActorSuffix     jsuffix;
                JazzPlayAnimationNode.ActorSuffixList jsuffixes
                    = jpan.ActorSuffixes;
                SlotSetupBuilder.ActorSuffix   suffix;
                SlotSetupBuilder.ActorSuffix[] suffixes
                    = this.mSlotSetup.ActorSuffixArray;
                for (i = 0; i < suffixes.Length; i++)
                {
                    suffix  = suffixes[i];
                    jsuffix = new JazzPlayAnimationNode.ActorSuffix(0, null);
                    jsuffix.ActorNameHash = suffix.Actor == null
                        ? 0 : suffix.Actor.NameHash;
                    jsuffix.SuffixHash = suffix.Param == null
                        ? 0 : suffix.Param.NameHash;
                    jsuffixes.Add(jsuffix);
                }
            }
            jpan.AdditiveClipResource
                = string.IsNullOrEmpty(this.mAdditiveClipPattern)
                ? this.mAdditiveClipKey : DummyKey;
            jpan.Animation         = this.mClipPattern ?? "";
            jpan.AdditiveAnimation = this.mAdditiveClipPattern ?? "";

            jpan.AnimationNodeFlags = this.Flags;
            jpan.AnimationPriority1 = this.Priority;
            jpan.BlendInTime        = this.BlendInTime;
            jpan.BlendOutTime       = this.BlendOutTime;
            jpan.Speed = this.Speed;
            ActorDefinition actor = this.Actor;

            jpan.ActorDefinitionIndex = actor == null
                ? NullCRef : actor.ChunkReference;
            jpan.TimingPriority = this.TimingPriority;
            if (this.TargetCount > 0)
            {
                JazzChunk.ChunkReferenceList dgi     = jpan.DecisionGraphIndexes;
                DecisionGraphNode[]          targets = this.Targets;
                Array.Sort(targets, 0, targets.Length,
                           AChunkObject.InstantiationComparer.Instance);
                for (i = 0; i < targets.Length; i++)
                {
                    dgi.Add(targets[i] == null
                        ? NullCRef : targets[i].ChunkReference);
                }
            }
            return(new GenericRCOLResource.ChunkEntry(0, null, tgi, jpan));
        }
Example #10
0
 public void AddNamespaceSlotSuffix(ActorDefinition targetNamespace,
                                    ParamDefinition suffixParameter)
 {
     this.mActorSuffixList.Add(
         new ActorSuffix(targetNamespace, suffixParameter));
 }
Example #11
0
 public ActorSuffix(ActorDefinition actor, ParamDefinition param)
 {
     this.Actor = actor;
     this.Param = param;
 }
Example #12
0
 public AnimNamespace(string name, ActorDefinition Actor)
 {
     this.Name  = name;
     this.Actor = Actor;
 }