Exemplo n.º 1
0
        private void Tb_Leave(object sender, EventArgs e)
        {
            TextBox tb = (TextBox)sender;

            try
            {
                UInt16 newValue = UInt16.Parse(tb.Text);
                tb.Tag = tb.Text;
                if (cbAutoCommit.Checked)
                {
                    MemoryHandler mh = new MemoryHandler();
                    if (mh.version >= 0)
                    {
                        int x = TLPRoom.GetPositionFromControl(tb).Column;
                        int y = TLPRoom.GetPositionFromControl(tb).Row;

                        mh.commitSingleRoom(newValue, listBoxRoomLayerMemoryOrder.SelectedIndex, x, y, map);
                        updateRoomGrid(listBoxRoomLayerMemoryOrder.SelectedIndex);
                    }
                }
            }
            catch
            {
                tb.Text = tb.Tag.ToString();
            }
        }
Exemplo n.º 2
0
        private void mapTextBox_Leave(object sender, EventArgs e)
        {
            TextBox tb = (TextBox)sender;

            try
            {
                Int16  displayValue = Int16.Parse(tb.Text);
                UInt16 newValue     = map.shortToUshort(displayValue);
                tb.Tag = tb.Text;
                if (CBAutoCommit.Checked)
                {
                    MemoryHandler mh = new MemoryHandler();
                    if (mh.version >= 0)
                    {
                        int x = tableFullMap.GetPositionFromControl(tb).Column;
                        int y = tableFullMap.GetPositionFromControl(tb).Row;

                        int finalIndex = y + x * 18;
                        map.mapInfoArray[listBoxMapLayer.SelectedIndex][finalIndex] = newValue;
                        mh.commitSingleMap(newValue, listBoxMapLayer.SelectedIndex, finalIndex);
                    }
                }
            }
            catch
            {
                tb.Text = tb.Tag.ToString();
            }
        }
        private void PBRoomSpriteGrid_Click(object sender, EventArgs e)
        {
            MouseEventArgs me = (MouseEventArgs)e;
            PictureBox     PB = (PictureBox)sender;

            if (me.Button == MouseButtons.Left)
            {
                int    x = TLPRoom.GetPositionFromControl(PB).Column;
                int    y = TLPRoom.GetPositionFromControl(PB).Row;
                UInt16 imgValueHolder   = (UInt16)selectedImageValue;
                Bitmap selectedImageBMP = getSpriteByID(selectedImageValue);
                if (cbVerticalFlip.Checked)
                {
                    imgValueHolder += 5000;
                    selectedImageBMP.RotateFlip(RotateFlipType.Rotate180FlipX);
                }
                if (cbHorizontalFlip.Checked)
                {
                    imgValueHolder = (UInt16)(65536 - imgValueHolder);
                    selectedImageBMP.RotateFlip(RotateFlipType.Rotate180FlipY);
                }

                MemoryHandler mh = new MemoryHandler();
                if (mh.version >= 0)
                {
                    mh.commitSingleRoom(imgValueHolder, lbLayer.SelectedIndex + 3, x, y, map);

                    PB.Image = selectedImageBMP;
                    PB.Tag   = imgValueHolder;
                }
            }
            else if (me.Button == MouseButtons.Right)
            {
                if (cbRightClickCopy.Checked)
                {
                    int spriteIDHolder = int.Parse(PB.Tag.ToString());
                    if (spriteIDHolder > 58740)
                    {
                        spriteIDHolder = Math.Abs(65536 - spriteIDHolder);
                    }
                    if (spriteIDHolder > 5000)
                    {
                        spriteIDHolder = (spriteIDHolder - 5000);
                    }
                    updateSinglePalette(palatteCurrentCoord, spriteIDHolder);
                    selectedImageValue = spriteIDHolder;
                }
            }
        }
        private void PBGridClick_Click(object sender, EventArgs e)
        {
            PictureBox PB = (PictureBox)sender;
            int        x  = TLPRoom.GetPositionFromControl(PB).Column;
            int        y  = TLPRoom.GetPositionFromControl(PB).Row;
            Bitmap     selectedImageBMP = getCollisionByID(selectedCollisionValue);


            MemoryHandler mh = new MemoryHandler();

            if (mh.version >= 0)
            {
                mh.commitSingleRoom(selectedCollisionValue, 0, x, y, map);

                PB.Image = selectedImageBMP;
            }
        }
Exemplo n.º 5
0
        public void commitChanges()
        {
            UInt16[] currentLayerValueArray = new ushort[450];
            for (int i = 0; i < 25; i++)
            {
                for (int j = 0; j < 17; j++)
                {
                    currentLayerValueArray[j + i * 18] = map.shortToUshort(Int16.Parse(tableFullMap.GetControlFromPosition(i, j).Text));
                }
            }
            map.mapInfoArray[listBoxMapLayer.SelectedIndex] = currentLayerValueArray;
            MemoryHandler mh = new MemoryHandler();

            if (mh.version >= 0)
            {
                mh.commitFullMapLayer(listBoxMapLayer.SelectedIndex, map, CBCacheCommit.Checked);
                fillMap(listBoxMapLayer.SelectedIndex);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Load map from memory into arrays
        /// </summary>
        public void loadMap()
        {
            MemoryHandler mh = new MemoryHandler();

            if (mh.version >= 0)
            {
                for (int i = 0; i < roomLayerArray.GetLength(0); i++)
                {
                    roomLayerArray[i] = mh.getMapRoomLayer(i);
                }
                for (int i = 0; i < mapInfoArray.GetLength(0); i++)
                {
                    mapInfoArray[i] = new UInt16[450];
                    mapInfoArray[i] = mh.getMapInfoLayer(i);
                }
                currentArea = mh.areaID;
            }
            loaded = true;
        }
Exemplo n.º 7
0
        public void commitRoomChanges()
        {
            MemoryHandler mh = new MemoryHandler();

            if (mh.version >= 0)
            {
                for (int i = 0; i < 20; i++)
                {
                    for (int j = 0; j < map.verticalHeights[map.currentRoomY]; j++)
                    {
                        int finalIndex = j + i * 200;
                        finalIndex += map.verticalHeights.Take <int>(map.currentRoomY).Sum();
                        finalIndex += map.currentRoomX * 4000;
                        UInt16 newValue = UInt16.Parse(TLPRoom.GetControlFromPosition(i, j).Text);

                        map.roomLayerArray[listBoxRoomLayerMemoryOrder.SelectedIndex][finalIndex] = newValue;

                        mh.commitSingleRoom(newValue, listBoxRoomLayerMemoryOrder.SelectedIndex, finalIndex);
                    }
                }
                updateRoomGrid(listBoxRoomLayerMemoryOrder.SelectedIndex);
            }
        }