Exemple #1
0
        public override void Read(R1TextParser parser)
        {
            // Create the dictionary
            DESManifest = new Dictionary <string, string>();

            string firstValue;

            while ((firstValue = parser.ReadValue()) != null)
            {
                // Add the item
                DESManifest.Add(firstValue, parser.ReadValue());
            }
        }
Exemple #2
0
        public override void Read(R1TextParser parser)
        {
            var tempList      = new List <R1_Mapper_SaveEventInstance[]>();
            var tempGroupList = new List <R1_Mapper_SaveEventInstance>();

            parser.SupportsComments  = false;
            parser.SeparateAtPadding = true;

            string value;

            while ((value = parser.ReadValue()) != null)
            {
                // NOTE: There is data before the instances, but the game doesn't read it. It's auto-generated by the editor when saving based on memory offsets, probably for debugging and/or compiling on Jaguar.

                // Check for event instances
                if (value == "ev_ty1")
                {
                    R1_Mapper_SaveEventInstance item = new R1_Mapper_SaveEventInstance();
                    item.IsValid            = parser.ReadShortValue();
                    item.OffsetX            = parser.ReadShortValue();
                    item.OffsetY            = parser.ReadShortValue();
                    item.EventDefinitionKey = parser.ReadValue();
                    item.HitPoints          = parser.ReadShortValue();
                    item.DisplayPrio        = parser.ReadByteValue();
                    item.LinkID             = parser.ReadShortValue();
                    tempGroupList.Add(item);
                }
                // Check for group end
                else if (value == "ev_end")
                {
                    tempList.Add(tempGroupList.ToArray());
                    tempGroupList.Clear();
                }
            }

            SaveEventInstances = tempList.ToArray();
        }
        public override void Read(R1TextParser parser)
        {
            var tempStrings = new List <string>();

            string value;

            // Read values into a temporary list
            while ((value = parser.ReadValue(true)) != null)
            {
                tempStrings.Add(value);
            }

            // Set strings
            Strings = tempStrings.ToArray();
        }
        public override void Read(R1TextParser parser)
        {
            var ed  = new List <R1_Mapper_EventDefinition>();
            var aed = new List <R1_Mapper_AlwaysEventDefinition>();

            while (true)
            {
                // Get the next value
                var value = parser.ReadValue();

                // Stop reading once we reached the end
                if (value == null)
                {
                    break;
                }

                // Only parse event definitions
                if (value != "£def")
                {
                    continue;
                }

                // Create a definition
                R1_Mapper_BaseEventDefinition item;

                // Get the name
                var name = parser.ReadValue();

                // Create the definition
                if (name == "always")
                {
                    var alwaysItem = new R1_Mapper_AlwaysEventDefinition();
                    aed.Add(alwaysItem);
                    item = alwaysItem;
                }
                else
                {
                    var normalItem = new R1_Mapper_EventDefinition();
                    ed.Add(normalItem);
                    item = normalItem;
                }

                // Set the name
                item.Name = name;

                var nextValue = parser.ReadValue();

                // Read the if values if it's an always object
                if (item is R1_Mapper_AlwaysEventDefinition ae && nextValue == "£if")
                {
                    var ifBuffer = new List <string>();

                    while (true)
                    {
                        nextValue = parser.ReadValue();

                        if (nextValue == "£endif")
                        {
                            break;
                        }

                        ifBuffer.Add(nextValue);
                    }

                    ae.IfCommand = ifBuffer.ToArray();

                    nextValue = parser.ReadValue();
                }

                item.DESFile     = nextValue;
                item.DisplayPrio = parser.ReadByteValue();
                item.ETAFile     = parser.ReadValue();

                var cmdBuffer = new List <short>();

                do
                {
                    // Since command parameters can be both signed and unsigned bytes we read them as shorts
                    cmdBuffer.Add(parser.ReadShortValue());
                } while (cmdBuffer.Last() != 0xFF);

                item.EventCommands = cmdBuffer.Select(x => (byte)x).ToArray();

                // Read values
                item.XPosition = parser.ReadShortValue();
                item.YPosition = parser.ReadShortValue();

                item.Etat    = parser.ReadByteValue();
                item.SubEtat = parser.ReadByteValue();

                item.OffsetBX = parser.ReadByteValue();
                item.OffsetBY = parser.ReadByteValue();
                item.OffsetHY = parser.ReadByteValue();

                item.FollowEnabled = parser.ReadByteValue();
                item.FollowSprite  = parser.ReadByteValue();
                item.HitPoints     = parser.ReadUIntValue();

                item.Type      = (R1_EventType)parser.ReadShortValue();
                item.HitSprite = parser.ReadByteValue();

                // Read the group if it's not an always object
                if (item is R1_Mapper_EventDefinition e)
                {
                    e.DesignerGroup = parser.ReadByteValue();
                }
            }

            // Set the parsed values
            EventDefinitions       = ed.ToArray();
            AlwaysEventDefinitions = aed.ToArray();
        }
Exemple #5
0
        public override void Read(R1TextParser parser)
        {
            // Get the xor keys to use based on version
            KeyValuePair <uint, byte>[] values;

            switch (parser.GameSettings.GameModeSelection)
            {
            // Same loc as 1.00
            case GameModeSelection.RaymanPC_Demo_1:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0xE4)
                };
                break;

            case GameModeSelection.RaymanPC_1_00:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0x9A),
                    new KeyValuePair <uint, byte>(4175, 0x37),
                    new KeyValuePair <uint, byte>(8791, 0x46)
                };
                break;

            case GameModeSelection.RaymanClassicMobile:
            case GameModeSelection.RaymanPC_1_10:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0xDC),
                    new KeyValuePair <uint, byte>(4176, 0xC4),
                    new KeyValuePair <uint, byte>(8796, 0xC0)
                };
                break;

            case GameModeSelection.RaymanPC_Demo_2:
            case GameModeSelection.RaymanPC_1_12:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0x4B),
                    new KeyValuePair <uint, byte>(4175, 0x6F),
                    new KeyValuePair <uint, byte>(8795, 0xB2)
                };
                break;

            case GameModeSelection.RaymanPC_1_21_JP:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0xFC),
                    new KeyValuePair <uint, byte>(4234, 0x85),
                    new KeyValuePair <uint, byte>(8947, 0xD5),
                    new KeyValuePair <uint, byte>(13850, 0x59)
                };
                break;

            case GameModeSelection.RaymanPocketPC:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0x61),
                    new KeyValuePair <uint, byte>(4338, 0x82),
                    new KeyValuePair <uint, byte>(8637, 0x62),
                    new KeyValuePair <uint, byte>(12814, 0xE7),
                    new KeyValuePair <uint, byte>(17557, 0x1C)
                };
                break;

            case GameModeSelection.RaymanPC_1_20:
            case GameModeSelection.RaymanPC_1_21:
                values = new KeyValuePair <uint, byte>[]
                {
                    new KeyValuePair <uint, byte>(0, 0x30),
                    new KeyValuePair <uint, byte>(4234, 0x82),
                    new KeyValuePair <uint, byte>(8947, 0xCF),
                    new KeyValuePair <uint, byte>(13850, 0xD0),
                    new KeyValuePair <uint, byte>(16361, 0x95)
                };
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Create the array
            Strings = new string[values.Length][];

            // Read each language block
            for (int i = 0; i < Strings.Length; i++)
            {
                // Go to offset
                parser.GoTo(values[i].Key);

                // Begin xor
                parser.BeginXOR(values[i].Value);

                var tempStrings = new List <string>();

                string value;

                // Read values into a temporary list
                while ((value = parser.ReadValue(true)) != null)
                {
                    tempStrings.Add(value);
                }

                // Set strings
                Strings[i] = tempStrings.ToArray();

                // End xor
                parser.EndXOR();
            }
        }
Exemple #6
0
        public override void Read(R1TextParser parser)
        {
            var ed  = new List <R1_Mapper_EventCMDItem>();
            var aed = new List <R1_Mapper_AlwaysEventCMDItem>();

            while (true)
            {
                // Get the next value
                var etaFile = parser.ReadValue();

                // Stop reading once we reached the end
                if (etaFile == null)
                {
                    break;
                }

                // Create a definition
                R1_Mapper_EventDefinition item;

                // Get the name
                var name = parser.ReadValue();

                // Create the definition
                if (name == "always")
                {
                    var alwaysItem = new R1_Mapper_AlwaysEventCMDItem();
                    aed.Add(alwaysItem);
                    item = alwaysItem;
                }
                else
                {
                    var normalItem = new R1_Mapper_EventCMDItem();
                    ed.Add(normalItem);
                    item = normalItem;
                }

                // Set the ETA file name
                item.ETAFile = etaFile;

                // Set the name
                item.Name = name;

                var cmdBuffer = new List <short>();

                do
                {
                    // Since command parameters can be both signed and unsigned bytes we read them as shorts
                    cmdBuffer.Add(parser.ReadShortValue());
                } while (cmdBuffer.Last() != 0xFF);

                item.EventCommands = cmdBuffer.Select(x => (byte)x).ToArray();

                // Read values
                item.XPosition = parser.ReadShortValue();
                item.YPosition = parser.ReadShortValue();

                if (item is R1_Mapper_EventCMDItem med)
                {
                    med.DisplayPrio = parser.ReadByteValue();
                    med.LinkID      = parser.ReadShortValue();
                }

                item.Etat    = parser.ReadByteValue();
                item.SubEtat = parser.ReadByteValue();

                item.OffsetBX = parser.ReadByteValue();
                item.OffsetBY = parser.ReadByteValue();
                item.OffsetHY = parser.ReadByteValue();

                item.FollowEnabled = parser.ReadByteValue();
                item.FollowSprite  = parser.ReadByteValue();
                item.HitPoints     = parser.ReadUIntValue();

                item.Type          = (R1_EventType)parser.ReadShortValue();
                item.HitSprite     = parser.ReadByteValue();
                item.DesignerGroup = parser.ReadByteValue();
            }

            // Set the parsed values
            Events       = ed.ToArray();
            AlwaysEvents = aed.ToArray();
        }