Beispiel #1
0
        public static ScriptBlock[] FromBlock(TI.IBlock block)
        {
            TI.IElementArray ea    = block.GetElements();
            ScriptBlock[]    value = new ScriptBlock[ea.Count];

            hs_scripts_block hs;

            for (int x = 0; x < value.Length; x++)
            {
                hs = (hs_scripts_block)ea.GetElement(x);
                var v = value[x] = new ScriptBlock();

                v.Name       = hs.Name.ToString();
                v.ScriptType = (short)hs.ScriptType.Value;
                v.ReturnType = (short)hs.ReturnType.Value;
                Blam.DatumIndex index = hs.RootExpressionIndex.Value;
                v.NodeOffset = index.Index;

                if (v.Name == TagInterface.StringId.kEncryptedResult)
                {
                    v.Name = (hs.Name as TagInterface.StringId).Handle.ToUInt32().ToString("X8");
                }
            }

            return(value);
        }
Beispiel #2
0
        protected ScenarioScriptInteropGen3(Blam.Cache.CacheFileGen3 cf,
                                            TI.IBlock hs_scripts,
                                            int hs_string_constants_offset,
                                            int hs_scripts_offset, int hs_globals_offset,
                                            int hs_nodes_offset)
        {
            scnr_offset = -1;
            foreach (var ci in cf.Index)
            {
                // The scenario's group tag has never changed so this check is OK
                if (!ci.IsEmpty && ci.GroupTag.ID == Blam.Halo3.TagGroups.scnr.ID)
                {
                    scnr_offset = ci.Offset;
                }
            }

            sncr_hs_scripts = hs_scripts;
            ReadStringData(cf, hs_string_constants_offset);
            ReadTagData(cf, hs_scripts_offset, hs_globals_offset,
                        hs_nodes_offset);
        }
Beispiel #3
0
        public static GlobalsBlock[] FromBlock(TI.IBlock block)
        {
            TI.IElementArray ea    = block.GetElements();
            GlobalsBlock[]   value = new GlobalsBlock[ea.Count];

            hs_globals_block hs;

            for (int x = 0; x < value.Length; x++)
            {
                hs = (hs_globals_block)ea.GetElement(x);
                var v = value[x] = new GlobalsBlock();

                v.Name = hs.Name.Value;
                v.Type = (short)hs.Type.Value;
                Blam.DatumIndex index = hs.InitExpressionIndex.Value;
                v.NodeOffset = index.Index;

                // We have to dynamically caluclate the node counts as
                // some globals are set at runtime, ie '(* 20 seconds)'
                v.NodeCount = -1;
            }

            return(value);
        }
Beispiel #4
0
		protected ScenarioScriptInteropGen3(Blam.Cache.CacheFileGen3 cf, 
			TI.IBlock hs_scripts,
			int hs_string_constants_offset, 
			int hs_scripts_offset, int hs_globals_offset,
			int hs_nodes_offset)
		{
			scnr_offset = -1;
			foreach (var ci in cf.Index)
				// The scenario's group tag has never changed so this check is OK
				if (!ci.IsEmpty && ci.GroupTag.ID == Blam.Halo3.TagGroups.scnr.ID)
					scnr_offset = ci.Offset;

			sncr_hs_scripts = hs_scripts;
			ReadStringData(cf, hs_string_constants_offset);
			ReadTagData(cf, hs_scripts_offset, hs_globals_offset,
				hs_nodes_offset);
		}