//Parses flo.dat from config.jag
        //Yup it's fixed
        public static FloorConfig[] ParseFloorConfig(byte[] floorData)
        {
            int floorCount;

            FloorConfig[]         floors;
            BigEndianBinaryReader floorReader = new BigEndianBinaryReader(new MemoryStream(floorData));

            floorCount = floorReader.ReadUInt16();
            floors     = new FloorConfig[floorCount];
            bool finishFloor = false;

            for (int i = 0; i < floorCount; i++)
            {
                floors[i]   = new FloorConfig();
                finishFloor = false;
                do
                {
                    int type = floorReader.ReadByte();
                    switch (type)
                    {
                    case 0:
                        finishFloor = true;
                        break;

                    case 1:
                        floors[i].actualColor = toRGB(floorReader.ReadUInt24());
                        break;

                    case 2:
                        floors[i].texture = floorReader.ReadByte();
                        break;

                    case 3:
                        floors[i].unknown = true;
                        break;

                    case 5:
                        floors[i].occlude = false;
                        break;

                    case 6:
                        floors[i].floorName = floorReader.ReadString().TrimEnd('\n');
                        break;

                    case 7:
                        floors[i].mapColor = toRGB(floorReader.ReadUInt24());
                        break;

                    default:
                        Logger.Log("Unrecognized floor type: " + type, LogType.Error);
                        break;
                    }
                } while (!finishFloor);
                Logger.Log(floors[i].ToString(), LogType.Success);
            }
            return(floors);
        }
Esempio n. 2
0
 //Parses flo.dat from config.jag
 //Yup it's fixed
 public static FloorConfig[] ParseFloorConfig(byte[] floorData)
 {
     int floorCount;
     FloorConfig[] floors;
     BigEndianBinaryReader floorReader = new BigEndianBinaryReader(new MemoryStream(floorData));
     floorCount = floorReader.ReadUInt16();
     floors = new FloorConfig[floorCount];
     bool finishFloor = false;
     for (int i = 0; i < floorCount; i++)
     {
         floors[i] = new FloorConfig();
         finishFloor = false;
         do
         {
             int type = floorReader.ReadByte();
             switch (type)
             {
                 case 0:
                     finishFloor = true;
                     break;
                 case 1:
                     floors[i].actualColor = toRGB(floorReader.ReadUInt24());
                     break;
                 case 2:
                     floors[i].texture = floorReader.ReadByte();
                     break;
                 case 3:
                     floors[i].unknown = true;
                     break;
                 case 5:
                     floors[i].occlude = false;
                     break;
                 case 6:
                     floors[i].floorName = floorReader.ReadString().TrimEnd('\n');
                     break;
                 case 7:
                     floors[i].mapColor = toRGB(floorReader.ReadUInt24());
                     break;
                 default:
                     Logger.Log("Unrecognized floor type: " + type, LogType.Error);
                     break;
             }
         } while (!finishFloor);
         Logger.Log(floors[i].ToString(), LogType.Success);
     }
     return floors;
 }