Exemple #1
0
        public void SetExit(ExitOW exit)
        {
            settingValues    = true;
            selectedExit     = exit;
            editingExit      = new ExitOW(exit.roomId, exit.mapId, exit.vramLocation, exit.yScroll, exit.xScroll, exit.playerY, exit.playerX, exit.cameraY, exit.cameraX, exit.unk1, exit.unk2, exit.doorType1, exit.doorType2);
            roomUpDown.Value = editingExit.roomId;
            mapUpDown.Value  = editingExit.mapId;

            int mapy = (editingExit.mapId / 8);
            int mapx = editingExit.mapId - (mapy * 8);

            pixelMapx = ((mapx) * 512);
            pixelMapy = ((mapy) * 512);

            xPosUpDown.Value          = (editingExit.playerX - pixelMapx);     //editingExit.playerX;
            yPosUpDown.Value          = (editingExit.playerY - ((pixelMapy))); //editingExit.playerY;
            xCameraUpDown.Value       = (editingExit.cameraX - (pixelMapx));
            yCameraUpDown.Value       = (editingExit.cameraY - (pixelMapy));
            xScrollUpDown.Value       = (editingExit.xScroll - (pixelMapx));
            yScrollUpDown.Value       = (editingExit.yScroll - (pixelMapy));
            editingExit.doorXEditor   = exit.doorXEditor;
            editingExit.doorYEditor   = exit.doorYEditor;
            doorxUpDown.Value         = editingExit.doorXEditor;
            dooryUpDown.Value         = editingExit.doorYEditor;
            editingExit.isAutomatic   = exit.isAutomatic;
            automaticcheckBox.Checked = editingExit.isAutomatic;
            nodoorradioButton.Checked = true;

            if ((editingExit.doorType1 & 0x8000) != 0)
            {
                bombdoorradioButton.Checked = true;
            }
            else if (editingExit.doorType1 != 0)
            {
                wooddoorradioButton.Checked = true;
            }
            else if ((editingExit.doorType2 & 0x8000) != 0)
            {
                castledoorradioButton.Checked = true;
            }
            else if (editingExit.doorType2 != 0)
            {
                sancdoorButton.Checked = true;
            }

            settingValues = false;
        }
Exemple #2
0
        public void drawExits()
        {
            for (int i = 0; i < 0x4F; i++)
            {
                ExitOW e          = OverworldGlobal.exits[i];
                Font   f2         = new Font("Courier New", 9, FontStyle.Bold);
                Brush  bgrBrush   = Brushes.WhiteSmoke;
                Brush  fontBrush  = Brushes.DarkSlateBlue;
                Pen    contourPen = Pens.Black;
                if (e.selected)
                {
                    bgrBrush   = Brushes.Black;
                    fontBrush  = Brushes.LimeGreen;
                    contourPen = Pens.LimeGreen;
                }


                if (e.mapId == room.index)
                {
                    int my = 0;
                    int mx = 0;
                    if (room.largeMap)
                    {
                        my = ((room.index) / 8);
                        mx = ((room.index) - (my * 8));
                        mx = mx << 9;
                        my = my << 9;
                        // Console.WriteLine(mx + "," + my);

                        graphicsOverlay.FillRectangle(bgrBrush, new Rectangle((e.playerX & 0x1FF) + (e.playerX & 0xFE00) - mx, (e.playerY & 0x1FF) + (e.playerY & 0xFE00) - my, 16, 16));
                        graphicsOverlay.DrawRectangle(contourPen, new Rectangle((e.playerX & 0x1FF) + (e.playerX & 0xFE00) - mx, (e.playerY & 0x1FF) + (e.playerY & 0xFE00) - my, 16, 16));
                        graphicsOverlay.DrawString(i.ToString("X2"), f2, fontBrush, new Point((e.playerX & 0x1FF) - 1 + (e.playerX & 0xFE00) - mx, (e.playerY & 0x1FF) + (e.playerY & 0xFE00) - my + 1));
                    }
                    else
                    {
                        graphicsOverlay.FillRectangle(bgrBrush, new Rectangle((e.playerX & 0x1FF), (e.playerY & 0x1FF), 16, 16));
                        graphicsOverlay.DrawRectangle(contourPen, new Rectangle((e.playerX & 0x1FF), (e.playerY & 0x1FF), 16, 16));
                        graphicsOverlay.DrawString(i.ToString("X2"), f2, fontBrush, new Point((e.playerX & 0x1FF) - 1, (e.playerY & 0x1FF) + 1));
                    }
                }
            }
        }
Exemple #3
0
        private void onMouseDown(object sender, MouseEventArgs e)
        {
            this.Focus();
            mainForm.activeScene = this;
            mainForm.mapPropertyGrid.SelectedObject = this;
            mouse_down = true;

            selectedObject = null;
            for (int i = 0; i < 0x4F; i++)
            {
                ExitOW o = OverworldGlobal.exits[i];
                o.selected = false;
                Rectangle bbox;
                if (o.mapId == room.index)
                {
                    int my = 0;
                    int mx = 0;
                    if (room.largeMap)
                    {
                        my   = ((room.index) / 8);
                        mx   = ((room.index) - (my * 8));
                        mx   = mx << 9;
                        my   = my << 9;
                        bbox = new Rectangle((o.playerX & 0x1FF) + (o.playerX & 0xFE00) - mx, (o.playerY & 0x1FF) + (o.playerY & 0xFE00) - my, 16, 16);
                    }
                    else
                    {
                        bbox = new Rectangle((o.playerX & 0x1FF), (o.playerY & 0x1FF), 16, 16);
                    }

                    if (e.X > bbox.X && e.Y > bbox.Y && e.X < bbox.X + 16 && e.Y < bbox.Y + 16)
                    {
                        o.selected     = true;
                        selectedObject = o;
                    }
                }
            }
            need_refresh = true;
        }