Inheritance: ProjectIndexedDataType
Esempio n. 1
0
        internal Area(Project p, int i) : base(p, i)
        {
            areaFile = Project.GetFileWithLabel("areaData");

            areaData = areaFile.GetData("areaData", Index * 8);


            // If this is Seasons, it's possible that areaData does not point to 8 bytes as
            // expected, but instead to an "m_SeasonalData" macro.
            if (areaData.CommandLowerCase == "m_seasonalarea")
            {
                int season = 0;
                areaData = Project.GetData(areaData.GetValue(0), season * 8);
            }

            // Initialize graphics state
            graphicsState = new GraphicsState();
            // Global palettes
            PaletteHeaderGroup globalPaletteHeaderGroup =
                Project.GetIndexedDataType <PaletteHeaderGroup>(0xf);

            graphicsState.AddPaletteHeaderGroup(globalPaletteHeaderGroup, PaletteGroupType.Common);

            Data data = areaData;

            flags1 = p.EvalToInt(data.GetValue(0));

            data   = data.NextData;
            flags2 = p.EvalToInt(data.GetValue(0));

            data = data.NextData;
            SetUniqueGfx(Project.EvalToInt(data.GetValue(0)));

            data = data.NextData;
            SetMainGfx(Project.EvalToInt(data.GetValue(0)));

            data = data.NextData;
            SetPaletteHeader(Project.EvalToInt(data.GetValue(0)));

            data = data.NextData;
            SetTileset(Project.EvalToInt(data.GetValue(0)));

            data        = data.NextData;
            layoutGroup = Project.EvalToInt(data.GetValue(0));

            data = data.NextData;
            SetAnimation((byte)Project.EvalToInt(data.GetValue(0)));
        }
Esempio n. 2
0
        public void AddPaletteHeaderGroup(PaletteHeaderGroup group, PaletteGroupType type)
        {
            int i = 0;

            while (i < paletteHeaderGroupList.Count && paletteHeaderGroupTypes[i] <= type)
            {
                i++;
            }
            paletteHeaderGroupList.Insert(i, group);
            paletteHeaderGroupTypes.Insert(i, type);
            if (!palettesModified && i == paletteHeaderGroupList.Count - 1)
            {
                LoadPaletteHeaderGroup(group);
            }
            else
            {
                palettesModified = true;
            }
        }
Esempio n. 3
0
        void LoadPaletteHeaderGroup(PaletteHeaderGroup group)
        {
            PaletteHeaderData header = group.FirstPaletteHeader;
            bool next = true;
            while (next) {
                RgbData data = header.Data;
                for (int i=header.FirstPalette; i<header.FirstPalette+header.NumPalettes; i++) {
                    for (int j=0; j<4; j++) {
                        paletteBuffer[(int)header.PaletteType][i][j] = data.Color;
                        data = data.NextData as RgbData;
                    }
                }

                next = false;

                if (header.ShouldHaveNext()) {
                    PaletteHeaderData nextHeader = header.NextData as PaletteHeaderData;
                    if (nextHeader != null) {
                        header = nextHeader;
                        next = true;
                    }
                    // Might wanna print a warning if no next value is found
                }
            }
        }
Esempio n. 4
0
 public void AddPaletteHeaderGroup(PaletteHeaderGroup group, PaletteGroupType type)
 {
     int i = 0;
     while (i < paletteHeaderGroupList.Count && paletteHeaderGroupTypes[i] <= type)
         i++;
     paletteHeaderGroupList.Insert(i, group);
     paletteHeaderGroupTypes.Insert(i, type);
     if (!palettesModified && i == paletteHeaderGroupList.Count-1)
         LoadPaletteHeaderGroup(group);
     else
         palettesModified = true;
 }