Example #1
0
            public Entry(Reader reader)
            {
                entryType = reader.ReadUInt16();
                if (entryType != 0)
                {
                    unk1 = reader.ReadUInt16();
                    unk4 = reader.ReadUInt32();
                    unk5 = reader.ReadByte();
                    unk6 = reader.ReadByte();
                    unk2 = reader.ReadByte();
                    unk3 = reader.ReadByte();

                    // Unused stuff for this entry type
                    obj         = new Reference <PhysicalObject>();
                    index_scale = 0xFFFF;
                    type        = 0xFFFF;
                    scale       = null;
                }
                else
                {
                    unk1        = reader.ReadUInt16();
                    obj         = new Reference <PhysicalObject>(reader, true);
                    index_scale = reader.ReadUInt16();
                    type        = reader.ReadUInt16();
                    unk2        = reader.ReadByte();
                    unk3        = reader.ReadByte();

                    // Unused stuff for this entry type
                    unk4 = 0;
                    unk5 = 0;
                    unk6 = 0;

                    if (index_scale != 0xFFFF)
                    {
                        EngineStruct es = Loader.Get <EngineStruct>(0 | (ushort)FATEntry.Flag.Fix);
                        scale = es.vectors_1_poScales.Value.vectors[index_scale];
                    }
                    else
                    {
                        scale = null;
                    }
                }
            }
Example #2
0
    public WebJSON.InputStruct GetInputJSON()
    {
        switch (MapLoader.Loader)
        {
        case OpenSpace.Loader.R2ROMLoader roml:
            OpenSpace.ROM.EngineStruct     es  = roml.Get <OpenSpace.ROM.EngineStruct>(0 | (ushort)OpenSpace.ROM.FATEntry.Flag.Fix);
            OpenSpace.ROM.EntryActionArray eaa = es?.inputStruct?.Value?.entryActions?.Value;
            if (eaa != null && eaa.length > 0)
            {
                return(new WebJSON.InputStruct()
                {
                    EntryActions = eaa.entryActions.Select(ea => ea?.Value != null ? new WebJSON.EntryAction()
                    {
                        Name = ea?.Value.GetNameString(),
                        Input = ea?.Value.GetValueOnlyString()
                    } : null).ToArray()
                });
            }
            break;

        case OpenSpace.Loader.R2PS1Loader ps1l:
            return(null);

        default:
            MapLoader l = MapLoader.Loader;
            if (l.entryActions?.Count > 0)
            {
                return(new WebJSON.InputStruct()
                {
                    EntryActions = l.entryActions.Select(ea => ea != null ? new WebJSON.EntryAction()
                    {
                        Name = ea.ExportName,
                        Input = ea?.GetValueOnlyString()
                    } : null).ToArray()
                });
            }
            break;
        }
        return(null);
    }