Exemple #1
0
        private void buttonUnload_Click(object sender, EventArgs e)
        {
            //unlocks the input fields to receive a new request
            surface = null;
            updateLightmapViewer();

            textBoxBsp.ReadOnly     = false;
            textBoxFaceID.ReadOnly  = false;
            buttonBrowseBsp.Enabled = true;
            buttonLoad.Enabled      = true;
            radioButtonHDR.Enabled  = true;
            radioButtonLDR.Enabled  = true;
            buttonUpdate.Enabled    = false;
            buttonUnload.Enabled    = false;

            spinnerR.Value   = 0;
            spinnerR.Enabled = false;
            spinnerG.Value   = 0;
            spinnerG.Enabled = false;
            spinnerB.Value   = 0;
            spinnerB.Enabled = false;
            spinnerE.Value   = 0;
            spinnerE.Enabled = false;
            labelRGB.Text    = "";

            timer1.Stop();

            map.file.Close();
        }
Exemple #2
0
        public void randoLightmap()
        {
            Random rand = new Random();

            for (int i = 0; i < bsp.offsets[7].Value / 56; i++)
            {
                Dface_t face = new Dface_t(i, bsp);
                face.randoLightmaps(rand);
                face.writeLightmap();
            }
        }
Exemple #3
0
        private void buttonLoad_Click(object sender, EventArgs e)
        {
            if (map != null)
            {
                map.file.Close();
            }

            try
            {
                FileInfo file = new FileInfo(textBoxBsp.Text);
                map = new Bsp(new FileInfo(textBoxBsp.Text));
                if (!map.valid)
                {
                    buttonUnload_Click(null, new EventArgs());
                    return;
                }

                //checks if there's data either for ldr or hdr lightmaps
                if (!map.LDR && !map.HDR)
                {
                    MessageBox.Show("VRAD must be run first on this BSP file!");
                    buttonUnload_Click(null, new EventArgs());
                }
                else
                {
                    //enables/disable available options for ldr/hdr
                    if (map.LDR)
                    {
                        radioButtonLDR.Enabled = true;
                    }
                    else
                    {
                        radioButtonLDR.Enabled = false;
                        radioButtonLDR.Checked = false;
                        radioButtonHDR.Checked = true;
                    }
                    if (map.HDR)
                    {
                        radioButtonHDR.Enabled = true;
                    }
                    else
                    {
                        radioButtonHDR.Enabled = false;
                        radioButtonHDR.Checked = false;
                        radioButtonLDR.Checked = true;
                    }
                    //fetchs the face, displays data and locks controls while editing
                    ushort planenum  = ushort.Parse(textBoxFaceID.Text);
                    int    numPlanes = map.offsets[7].Value / Dface_t.classLength;
                    if (planenum >= numPlanes)
                    {
                        MessageBox.Show("The faceID you entered is too big"); //if we were to use this offset into lump 7 we would exceed it
                        buttonUnload_Click(null, new EventArgs());
                        return;
                    }
                    surface = new Dface_t(planenum, map);

                    selectedX = 0;
                    selectedY = 0;

                    updateLightmapViewer();

                    textBoxBsp.ReadOnly     = true;
                    textBoxFaceID.ReadOnly  = true;
                    buttonBrowseBsp.Enabled = false;
                    buttonLoad.Enabled      = false;
                    buttonUnload.Enabled    = true;
                    buttonUpdate.Enabled    = true;

                    spinnerR.Enabled = true;
                    spinnerG.Enabled = true;
                    spinnerB.Enabled = true;
                    spinnerE.Enabled = true;

                    if (checkBoxOverexp.Checked)
                    {
                        timer1.Start();
                        overexposedHighlight = true;
                    }
                }
            }
            catch (ArgumentException)
            {
                MessageBox.Show("You must choose a bsp", "Error", MessageBoxButtons.OK);
            }
            catch (/*FormatException*/ Exception)
            {
                MessageBox.Show("You must enter a faceID\n\nLoad your map in-game and use the command \"mat_surfaceid 2\" to display faceIDs.\n\"mat_wireframe 3\" is also useful to see face divisions.", "Error", MessageBoxButtons.OK);
            }
        }