Пример #1
0
		public s_cache_language_pack(TI.Definition parent)
		{
			parent.Add(new TI.Pad(
				4 // Index runtime hashing handle 
				+
				4 // Table runtime hashing handle 
				));
			parent.Add(Count = new TI.LongInteger());
			parent.Add(Size = new TI.LongInteger());
			parent.Add(OffsetIndex = new TI.LongInteger());
			parent.Add(OffsetTable = new TI.LongInteger());
			parent.Add(new TI.Skip(20)); // index SHA1 hash
			parent.Add(new TI.Skip(20)); // strings SHA1 hash
			parent.Add(new TI.Pad(1 + 3));
		}
Пример #2
0
		/// <summary>
		/// Initialize the language pack to a tag definition or as a stand-alone
		/// </summary>
		/// <param name="parent"></param>
		public s_cache_language_pack(TI.Definition parent)
		{
			Count = new TI.LongInteger();
			Size = new TI.LongInteger();
			OffsetReferences = new TI.LongInteger();
			OffsetStrings = new TI.LongInteger();

			if (parent != null)
			{
				parent.Add(new TI.Pad(4 + 4)); // runtime pointers
					// s_cache_unicode_string_reference* references_buffer
					// byte* strings_buffer
				parent.Add(Count);
				parent.Add(Size);
				parent.Add(OffsetReferences);
				parent.Add(OffsetStrings);
				parent.Add(new TI.Pad(1 + 3));
			}
		}
Пример #3
0
		static void GetFace(bool inc, TI.IElementArray ea, int fi, int index, out string s0, out string s1, out string s2)
		{
			if (ea == null)
			{
				s0 = s1 = s2 = "";
				return;
			}

			TI.Field f0 = ea[index+0, fi], f1 = ea[index+1,fi], f2 = ea[index+2,fi];
			var ft = f0.FieldType;

			switch (ft)
			{
				case TI.FieldType.ShortInteger:
					s0 = ((f0 as TI.ShortInteger).Value + (inc ? 1 : 0)).ToString();
					s1 = ((f1 as TI.ShortInteger).Value + (inc ? 1 : 0)).ToString();
					s2 = ((f2 as TI.ShortInteger).Value + (inc ? 1 : 0)).ToString();
					break;
				case TI.FieldType.LongInteger:
					s0 = ((f0 as TI.LongInteger).Value + (inc ? 1 : 0)).ToString();
					s1 = ((f1 as TI.LongInteger).Value + (inc ? 1 : 0)).ToString();
					s2 = ((f2 as TI.LongInteger).Value + (inc ? 1 : 0)).ToString();
					break;

				default: throw new Debug.Exceptions.UnreachableException(ft);
			}
		}
Пример #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);
		}
Пример #5
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;
		}
Пример #6
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;
		}
Пример #7
0
		public global_geometry_raw_point(TI.Definition parent)
		{
			parent.Add(Position = new TI.RealPoint3D());					// 0x0
			parent.Add(/*Node Index (OLD) = */ new TI.LongInteger());		// 0xC
			parent.Add(/*Node Index (OLD) = */ new TI.LongInteger());		// 0x10
			parent.Add(/*Node Index (OLD) = */ new TI.LongInteger());		// 0x14
			parent.Add(/*Node Index (OLD) = */ new TI.LongInteger());		// 0x18
			for (int x = 0; x < NodeWeight.Length; x++ )
				parent.Add(NodeWeight[x] = new TI.Real());
			for (int x = 0; x < NodeIndex.Length; x++)
				parent.Add(NodeIndex[x] = new TI.LongInteger());

			parent.Add(UseNewNodeIndices = new TI.LongInteger());			// 0x3C
			parent.Add(AdjustedCompoundNodeIndex = new TI.LongInteger());	// 0x40
		}
Пример #8
0
			public node_data(TI.Definition parent)
			{
				parent.Add(Scale = new TI.Real());
				parent.Add(Forward = new TI.RealVector3D());
				parent.Add(Left = new TI.RealVector3D());
				parent.Add(Up = new TI.RealVector3D());
				parent.Add(Position = new TI.RealPoint3D());
			}
Пример #9
0
		public global_model_skinned_uncompressed_vertex(TI.Definition parent, int node_weight_count)
		{
			NodeWeights = new TI.Real[node_weight_count];

			parent.Add(Position = new TI.RealPoint3D());
			parent.Add(NodeIndices[0] = new TI.ByteInteger());
			parent.Add(NodeIndices[1] = new TI.ByteInteger());
			parent.Add(NodeIndices[2] = new TI.ByteInteger());
			parent.Add(NodeIndices[3] = new TI.ByteInteger());
			for (int x = 0; x < NodeWeights.Length; x++ )
				parent.Add(NodeWeights[x] = new TI.Real());
		}
Пример #10
0
			public mass_distribution_data(TI.Definition parent)
			{
				parent.Add(CenterOfMass = new TI.RealVector3D());
				parent.Add(new TI.Skip(4));
				parent.Add(InertiaTensorI = new TI.RealVector3D());
				parent.Add(new TI.Skip(4));
				parent.Add(InertiaTensorJ = new TI.RealVector3D());
				parent.Add(new TI.Skip(4));
				parent.Add(InertiaTensorK = new TI.RealVector3D());
				parent.Add(new TI.Skip(4));
			}
Пример #11
0
			public shape_info(TI.Definition parent)
			{
				parent.Add(ShapeType = new TI.Enum());
				parent.Add(Shape = new TI.BlockIndex()); // 2
			}
Пример #12
0
			public hkSphereShape(TI.Definition parent) : base(parent)	{}
Пример #13
0
			public hkConvexShape(TI.Definition parent) : base(parent)
			{
				parent.Add(Radius = new TI.Real());
			}
Пример #14
0
			public hkShape(TI.Definition parent)
			{
				parent.Add(new TI.Skip(4));							// vtable
				parent.Add(Size = new TI.ShortInteger());
				parent.Add(ReferenceCount = new TI.ShortInteger());
				parent.Add(UserData = new TI.Skip(4)); // pointer to the shape block this shape is in
			}
Пример #15
0
		/// <param name="fi">field index</param>
		public void WriteFace(bool inc, TI.IElementArray ea, int fi, int index)
		{
			string s0, s1, s2;
			GetFace(inc, ea, fi, index, out s0, out s1, out s2);

			m_stream.WriteLine("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}", s0, s1, s2);
		}
Пример #16
0
		/// <param name="fi">field index</param>
		/// <param name="fi_t">field index</param>
		/// <param name="fi_n">field index</param>
		public void WriteFace(bool inc, TI.IElementArray ea, int fi, TI.IElementArray ea_t, int fi_t, TI.IElementArray ea_n, int fi_n, int index)
		{
			const string k_v_vt_vn = "f {0}/{1}/{2} {3}/{4}/{5} {6}/{7}/{8}";
			string fmt = k_v_vt_vn;

			string sv0, sv1, sv2,	svt0, svt1, svt2,	svn0, svn1, svn2;

			GetFace(inc, ea, fi, index, out sv0, out sv1, out sv2);
			GetFace(inc, ea_t, fi_t, index, out svt0, out svt1, out svt2);
			GetFace(inc, ea_n, fi_n, index, out svn0, out svn1, out svn2);

			m_stream.WriteLine(fmt, sv0, sv1, sv2,	svt0, svt1, svt2,	svn0, svn1, svn2);
		}
Пример #17
0
		public global_model_skinned_uncompressed_vertex(TI.Definition parent) : this(parent, 4)
		{
		}