Beispiel #1
0
        public bool split_CHR(bool _mode8x16)
        {
            // create a new bank and transfer all sprite data from the common bank to it
            CHR_data_group new_chr_data = new CHR_data_group();

            CHR_data_attr attr;

            int size = m_CHR_attr.Count;

            for (int i = 0; i < size; i++)
            {
                attr = m_CHR_attr[i];

                new_chr_data.get_data().Add(m_CHR_data.get_data()[attr.CHR_ind].copy());

                if (_mode8x16 && attr.CHR_ind + 1 < m_CHR_data.get_data().Count)
                {
                    new_chr_data.get_data().Add(m_CHR_data.get_data()[attr.CHR_ind + 1].copy());

                    attr.CHR_ind = i << 1;
                }
                else
                {
                    attr.CHR_ind = i;
                }
            }

            set_CHR_data(new_chr_data);

            return(true);
        }
Beispiel #2
0
        public void flip_vert(EAxesFlipType _ft)
#endif
        {
            m_CHR_attr.ForEach(delegate(CHR_data_attr _attr)
            {
#if DEF_NES || DEF_PCE
                _attr.vflip();
#elif DEF_SMS
                m_CHR_data.get_data()[_attr.CHR_ind].transform(CHR_data.ETransform.t_vflip);

                if (_8x16_mode && _attr.CHR_ind + 1 < m_CHR_data.get_data().Count)
                {
                    m_CHR_data.get_data()[_attr.CHR_ind + 1].transform(CHR_data.ETransform.t_vflip);

                    m_CHR_data.swap_CHRs(_attr.CHR_ind, _attr.CHR_ind + 1);
                }

                if (_transform_pos)
#endif
                {
                    switch (_ft)
                    {
                    case sprite_data.EAxesFlipType.aft_LOCAL_AXES:
                        {
                            int center = m_size_y >> 1;
                            _attr.y    = center - (_attr.y - center) - utils.CONST_CHR_SIDE_PIXELS_CNT;
                        }
                        break;

                    case sprite_data.EAxesFlipType.aft_GLOABL_AXES:
                        {
                            _attr.y = (-_attr.y - utils.CONST_CHR_SIDE_PIXELS_CNT) - m_offset_y;
#if !DEF_PCE
                            if (_8x16_mode)
                            {
                                _attr.y -= utils.CONST_CHR_SIDE_PIXELS_CNT;
                            }
#endif
                        }
                        break;
                    }
                }
            });

#if DEF_SMS
            if (_transform_pos)
#endif
            {
                if (_ft == sprite_data.EAxesFlipType.aft_GLOABL_AXES)
                {
                    // find a minimal Y value
                    int min_y = int.MaxValue;

                    m_CHR_attr.ForEach(delegate(CHR_data_attr _attr)
                    {
                        if (min_y > _attr.y)
                        {
                            min_y = _attr.y;
                        }
                    });

                    // attr.y -= min_y
                    m_CHR_attr.ForEach(delegate(CHR_data_attr _attr)
                    {
                        _attr.y -= min_y;
                    });

                    m_offset_y = min_y;
                }
            }
        }
 public void add_data_range(CHR_data_group _chr_data)
 {
     m_CHR_arr.InsertRange(m_CHR_arr.Count, _chr_data.get_data());
 }