private void validate_screens(data_sets_manager.EScreenDataType _scr_type,
                                      tiles_data _data)
        {
            int         scr_n;
            int         tile_n;
            ushort      tile_val;
            screen_data scr;

            int blocks_cnt = _data.blocks.Length >> 2;

            for (scr_n = 0; scr_n < _data.screen_data_cnt(); scr_n++)
            {
                scr = _data.get_screen_data(scr_n);

                for (tile_n = 0; tile_n < scr.m_arr.Length; tile_n++)
                {
                    tile_val = scr.m_arr[tile_n];

                    if (_scr_type == data_sets_manager.EScreenDataType.sdt_Tiles4x4)
                    {
                        if (tile_val >= _data.tiles.Length)
                        {
                            scr.m_arr[tile_n] = 0;
                        }
                    }
                    else
                    {
                        if (tile_val >= blocks_cnt)
                        {
                            scr.m_arr[tile_n] = 0;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        bool check_screens_block(int _block_id, tiles_data _data)
        {
            int block_n;
            int scr_n;
            int scr_block_n;

            screen_data scr;

            // check duplicate(s)
            for (block_n = 0; block_n < _block_id; block_n++)
            {
                if (_data.cmp_blocks(_block_id, block_n))
                {
                    for (scr_n = 0; scr_n < _data.screen_data_cnt(); scr_n++)
                    {
                        scr = _data.get_screen_data(scr_n);

                        for (scr_block_n = 0; scr_block_n < scr.length; scr_block_n++)
                        {
                            if (scr.get_tile(scr_block_n) == _block_id)
                            {
                                // replace _block_id with block_n
                                scr.set_tile(scr_block_n, ( ushort )block_n);
                            }
                        }
                    }
                }
            }

            for (scr_n = 0; scr_n < _data.screen_data_cnt(); scr_n++)
            {
                scr = _data.get_screen_data(scr_n);

                for (scr_block_n = 0; scr_block_n < scr.length; scr_block_n++)
                {
                    if (scr.get_tile(scr_block_n) == _block_id)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #3
0
        bool check_screens_tile(int _tile_id, tiles_data _data)
        {
            int tile_n;
            int scr_n;
            int scr_tile_n;

            screen_data scr;

            // check duplicate(s)
            for (tile_n = 0; tile_n < _tile_id; tile_n++)
            {
                if (_data.tiles[_tile_id] == _data.tiles[tile_n])
                {
                    for (scr_n = 0; scr_n < _data.screen_data_cnt(); scr_n++)
                    {
                        scr = _data.get_screen_data(scr_n);

                        for (scr_tile_n = 0; scr_tile_n < scr.length; scr_tile_n++)
                        {
                            if (scr.get_tile(scr_tile_n) == _tile_id)
                            {
                                // replace _tile_id with tile_n
                                scr.set_tile(scr_tile_n, ( ushort )tile_n);
                            }
                        }
                    }
                }
            }

            for (scr_n = 0; scr_n < _data.screen_data_cnt(); scr_n++)
            {
                scr = _data.get_screen_data(scr_n);

                for (scr_tile_n = 0; scr_tile_n < scr.length; scr_tile_n++)
                {
                    if (scr.get_tile(scr_tile_n) == _tile_id)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #4
0
        public ushort[] get_screen_data(int _bank_ind, int _scr_ind)
        {
            tiles_data data = m_data_mngr.get_tiles_data(_bank_ind);

            if (data != null)
            {
                if (_scr_ind >= 0 && _scr_ind < data.screen_data_cnt())
                {
                    return(copy_arr <ushort>(data.get_screen_data(_scr_ind).m_arr));
                }
            }

            return(null);
        }
Beispiel #5
0
        bool check_layouts_screen(int _scr_n, tiles_data _data)
        {
            int layout_n;
            int tiles_data_n;
            int scr_n;
            int curr_common_scr_ind;

            bool res = false;

            layout_data ldata = null;

            int layouts_cnt = m_data_sets.layouts_data_cnt;

            int bank_id = Convert.ToInt32(_data.name);

            // calc common screen index
            int common_scr_ind = _scr_n;

            for (tiles_data_n = 0; tiles_data_n < bank_id; tiles_data_n++)
            {
                common_scr_ind += m_data_sets.get_tiles_data(tiles_data_n).screen_data_cnt();
            }

            // check duplicate(s)
            for (scr_n = 0; scr_n < _scr_n; scr_n++)
            {
                if (_data.get_screen_data(scr_n).equal(_data.get_screen_data(_scr_n)) == true)
                {
                    curr_common_scr_ind = scr_n;

                    for (tiles_data_n = 0; tiles_data_n < bank_id; tiles_data_n++)
                    {
                        curr_common_scr_ind += m_data_sets.get_tiles_data(tiles_data_n).screen_data_cnt();
                    }

                    // remove duplicate(s)
                    for (layout_n = 0; layout_n < layouts_cnt; layout_n++)
                    {
                        ldata = m_data_sets.get_layout_data(layout_n);

                        ldata.get_raw_data().ForEach(delegate(List <layout_screen_data> _list)
                        {
                            _list.ForEach(delegate(layout_screen_data _scr_data)
                            {
                                if (_scr_data.m_scr_ind == common_scr_ind)
                                {
                                    _scr_data.m_scr_ind = curr_common_scr_ind;
                                }
                            });
                        });
                    }
                }
            }

            for (layout_n = 0; layout_n < layouts_cnt; layout_n++)
            {
                ldata = m_data_sets.get_layout_data(layout_n);

                ldata.get_raw_data().ForEach(delegate(List <layout_screen_data> _list)
                {
                    _list.ForEach(delegate(layout_screen_data _scr_data)
                    {
                        if (_scr_data.m_scr_ind == common_scr_ind)
                        {
                            res = true;

                            return;
                        }
                    });

                    if (res)
                    {
                        return;
                    }
                });
            }

            return(res);
        }