Exemple #1
0
        public Triangle(Vector3 vert1, Vector3 vert2, Vector3 vert3, Property prop, int groupIndex)
        {
            m_vertex1 = vert1;

            m_vertex2 = vert2;

            m_vertex3 = vert3;

            GroupIndex = groupIndex;

            m_camID     = prop.CameraID;
            m_soundID   = prop.SoundID;
            m_exitID    = prop.ExitIndex;
            m_polyColor = prop.PolyColor;

            m_linkNo      = prop.LinkNumber;
            m_wallCode    = prop.WallCode;
            m_specialCode = prop.SpecialCode;
            m_attribCode  = prop.AttributeCode;
            m_groundCode  = prop.GroundCode;

            m_camMoveBg     = prop.CamMoveBG;
            m_roomCamID     = prop.RoomCamID;
            m_roomPathID    = prop.RoomPathID;
            m_roomPathPntNo = prop.RoomPathPointNo;

            m_cameraBehavior = prop.CameraBehavior;
        }
Exemple #2
0
        public Property(Triangle tri)
        {
            m_attribCode = tri.AttributeCode;

            m_cameraBehavior = tri.CameraBehavior;

            m_camID = tri.CameraID;

            m_camMoveBg = tri.CamMoveBG;

            m_exitID = tri.ExitIndex;

            m_groundCode = tri.GroundCode;

            m_linkNo = tri.LinkNumber;

            m_polyColor = tri.PolyColor;

            m_roomCamID = tri.RoomCamID;

            m_roomPathID = tri.RoomPathID;

            m_roomPathPntNo = tri.RoomPathPointNo;

            m_soundID = tri.SoundID;

            m_specialCode = tri.SpecialCode;

            m_wallCode = tri.WallCode;
        }
Exemple #3
0
        public Property(EndianBinaryReader reader)
        {
            int bitField1 = reader.ReadInt32();

            m_camID     = (bitField1 & 0xFF);
            m_soundID   = (SoundID)((bitField1 & 0x1F00) >> 0x08);
            m_exitID    = (bitField1 & 0x7E000) >> 0x0D;
            m_polyColor = (bitField1 & 0x7F80000) >> 0x13;

            int bitField2 = reader.ReadInt32();

            m_linkNo      = (bitField2 & 0xFF);
            m_wallCode    = (WallCode)((bitField2 & 0xF00) >> 0x08);
            m_specialCode = (SpecialCode)((bitField2 & 0xF000) >> 0x0C);
            m_attribCode  = (AttributeCode)((bitField2 & 0x1F0000) >> 0x10);
            m_groundCode  = (GroundCode)((bitField2 & 0x3E00000) >> 0x15);

            int bitField3 = reader.ReadInt32();

            m_camMoveBg     = (bitField3 & 0xFF);
            m_roomCamID     = (bitField3 & 0xFF00) >> 0x08;
            m_roomPathID    = (bitField3 & 0xFF0000) >> 0x10;
            m_roomPathPntNo = (bitField3 & unchecked ((int)0xFF000000)) >> 0x18;

            m_cameraBehavior = reader.ReadInt32();
        }
		/// <summary>
		/// Construct a Detect attribute with a special opcode.
		/// </summary>
		/// <param name="code">Special opcode the method checks for</param>
		public DetectAttribute(SpecialCode code)
		{
			this.SpecialOpCode = code;
			this.IsSpecial = true;
		}
Exemple #5
0
        private static void TryReadTypeDefinition(ref int i, ref SpecialCode type)
        {
            SpecialCode specialcode = GetSpecialCode(i);
            if ((int)specialcode < 4) return;

            // ignore this particular switch
            if (!(specialcode == SpecialCode.Integer && type == SpecialCode.Date))
            {
                type = specialcode;
            }
            i += 2;
        }
Exemple #6
0
        private static void InterpretCode(string gameToken, string text, ref BinaryMap map, ref int i, ref SpecialCode type, ref bool quoted, string[] parents)
        {
            if (gameToken == "eu4")
            {
                switch (text)
                {
                    case "type":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (IsParent(parents, 1, "id") ||
                            IsParent(parents, 1, "leader") ||
                            (IsParent(parents, 1, "rebel_faction") && IsParent(parents, -1, "provinces")) ||
                            (IsParent(parents, 1, "advisor") && IsParent(parents, -1, "active_advisors")) ||
                            IsParent(parents, 1, "monarch"))
                        {
                            ReadInteger(ref i);
                        }
                        else if ((IsParent(parents, 1, "advisor") && IsParent(parents, 3, "history")) ||
                                 (IsParent(parents, 1, "advisor") && IsParent(parents, 2, "history")))
                        {
                            ReadString(ref i, false);
                        }
                        else if (IsParent(parents, 1, "advisor"))
                        {
                            ReadInteger(ref i);
                        }
                        else if (IsParent(parents, 1, "war_goal"))
                        {
                            ReadString(ref i, true);
                        }
                        else if (IsParent(parents, 1, "general"))
                        {
                            map.AddToken(GetTokenText(i));
                            i += 2;
                        }
                        else if (IsParent(parents, 1, "rebel_faction") ||
                            IsParent(parents, 1, "revolt") ||
                            IsParent(parents, 1, "mercenary") ||
                            IsParent(parents, 2, "previous_war"))
                        {
                            ReadString(ref i, true);
                        }
                        else if ((IsParent(parents, 1, "regiment") && !IsParent(parents, 2, "military_construction")) ||
                            IsParent(parents, 1, "ship") ||
                            IsParent(parents, 1, "faction") ||
                            IsParent(parents, 1, "military_construction") ||
                            IsParent(parents, 1, "possible_mercenary") ||
                            IsParent(parents, 1, "active_major_mission") ||
                            IsParent(parents, 1, "casus_belli") ||
                            IsParent(parents, 1, "take_province") ||
                            IsParent(parents, 1, "take_core") ||
                            IsParent(parents, 2, "active_war"))
                        {
                            ReadString(ref i, false);
                        }
                        else
                        {
                            ReadInteger(ref i);
                        }
                        break;
                    case "discovered_by":
                        map.AddToken(text);
                        i += 2;
                        if (parents.Length > 0 && parents[parents.Length - 1].StartsWith("-"))
                        {
                            quoted = false;
                        }
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        ReadString(ref i, true);
                        break;

                    case "action":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (IsParent(parents, 1, "diplomacy_construction"))
                        {
                            ReadString(ref i, true);
                        }
                        else if (IsParent(parents, 1, "previous_war"))
                        {
                            ReadDate(ref i, false);
                        }
                        else
                        {
                            ReadInteger(ref i);
                        }
                        break;

                    case "steer_power":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (IsParent(parents, 1, "node"))
                            ReadFloat(ref i);
                        else
                            ReadInteger(ref i);
                        break;

                    case "value":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (IsParent(parents, 1, "improve_relation") ||
                            IsParent(parents, 1, "warningaction"))
                            ReadBoolean(ref i);
                        else
                        {
                            ReadFloat(ref i);
                        }
                        break;

                    case "unit_type":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (parents.Length > 0 && parents[parents.Length - 1].StartsWith("O0"))
                        {
                            map.AddToken(GetTokenText(i));
                            i += 2;
                        }
                        else
                        {
                            ReadString(ref i, false);
                        }
                        break;

                    case "active":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (IsParent(parents, 1, "rebel_faction") ||
                            IsParent(parents, 1, "siege_combat") ||
                            IsParent(parents, 1, "combat"))
                        {
                            map.AddToken(GetTokenText(i));
                            i += 2;
                        }
                        else
                        {
                            ReadBoolean(ref i);
                        }
                        break;

                    case "revolution_target":
                        map.AddToken(text);
                        i += 2;
                        if (TryAddSpecials(ref i)) break;
                        TryReadTypeDefinition(ref i, ref type);

                        if (IsParent(parents, 2, "history"))
                        {
                            map.AddToken(GetTokenText(i));
                            i += 2;
                        }
                        else
                        {
                            ReadString(ref i, true);
                        }
                        break;

                    default:
                        i += 2;
                        break;
                }
            }
            else
            {
                i += 2;
            }
        }
 /// <summary>
 /// Construct a Detect attribute with a special opcode.
 /// </summary>
 /// <param name="code">Special opcode the method checks for</param>
 public DetectAttribute(SpecialCode code)
 {
     this.SpecialOpCode = code;
     this.IsSpecial     = true;
 }