Exemple #1
0
        public void Parse(byte[] data, ref int offset)
        {
            int i;

            for (i = 0; i < conditions.Length; i++)
            {
                TriggerCondition c = new TriggerCondition();
                c.Number           = Util.ReadDWord(data, offset); offset += 4;
                c.Group            = Util.ReadDWord(data, offset); offset += 4;
                c.Amount           = Util.ReadDWord(data, offset); offset += 4;
                c.UnitType         = Util.ReadWord(data, offset); offset += 2;
                c.ComparisonSwitch = data[offset++];
                c.Condition        = data[offset++];
                c.Resource         = data[offset++];
                c.Flags            = data[offset++];

                // padding
                offset += 2;

                conditions[i] = c;
            }

            for (i = 0; i < actions.Length; i++)
            {
                TriggerAction a = new TriggerAction();

                a.Location  = Util.ReadDWord(data, offset); offset += 4;
                a.TextIndex = Util.ReadDWord(data, offset); offset += 4;
                a.WavIndex  = Util.ReadWord(data, offset); offset += 4;
                a.Delay     = Util.ReadDWord(data, offset); offset += 4;
                a.Group1    = Util.ReadDWord(data, offset); offset += 4;
                a.Group2    = Util.ReadDWord(data, offset); offset += 4;
                a.UnitType  = Util.ReadWord(data, offset); offset += 2;
                a.Action    = data[offset++];
                a.Switch    = data[offset++];
                a.Flags     = data[offset++];

                // padding
                offset += 3;

                actions[i] = a;
            }

            // more padding?
            offset += 4;


            // this is 1 byte for each player in the groups list:
            //
            // 00 - trigger is not executed for player
            // 01 - trigger is executed for player
            offset += 28;
        }
Exemple #2
0
		public void Parse (byte[] data, ref int offset)
		{
			int i;
			for (i = 0; i < conditions.Length; i ++) {
				TriggerCondition c = new TriggerCondition ();
				c.Number = Util.ReadDWord (data, offset); offset += 4;
				c.Group = Util.ReadDWord (data, offset); offset += 4;
				c.Amount = Util.ReadDWord (data, offset); offset += 4;
				c.UnitType = Util.ReadWord (data, offset); offset += 2;
				c.ComparisonSwitch = data[offset++];
				c.Condition = data[offset++];
				c.Resource = data[offset++];
				c.Flags = data[offset++];

				// padding
				offset += 2;

				conditions[i] = c;
			}

			for (i = 0; i < actions.Length; i ++) {
				TriggerAction a = new TriggerAction ();
				
				a.Location = Util.ReadDWord (data, offset); offset += 4;
				a.TextIndex = Util.ReadDWord (data, offset); offset += 4;
				a.WavIndex = Util.ReadWord (data, offset); offset += 4;
				a.Delay = Util.ReadDWord (data, offset); offset += 4;
				a.Group1 = Util.ReadDWord (data, offset); offset += 4;
				a.Group2 = Util.ReadDWord (data, offset); offset += 4;
				a.UnitType = Util.ReadWord (data, offset); offset += 2;
				a.Action = data[offset++];
				a.Switch = data[offset++];
				a.Flags = data[offset++];

				// padding
				offset += 3;

				actions[i] = a;
			}

			// more padding?
			offset += 4;


			// this is 1 byte for each player in the groups list:
			//
			// 00 - trigger is not executed for player
			// 01 - trigger is executed for player
			offset += 28;
		}