Пример #1
0
        // Sbar_DeathmatchOverlay
        static void MiniDeathmatchOverlay()
        {
            if (Scr.vid.width < 512 || Sbar.Lines == 0)
            {
                return;
            }

            Scr.CopyEverithing = true;
            Scr.FullUpdate     = 0;

            // scores
            SortFrags();

            // draw the text
            int l        = _ScoreBoardLines;
            int y        = Scr.vid.height - Sbar.Lines;
            int numlines = Sbar.Lines / 8;

            if (numlines < 3)
            {
                return;
            }

            //find us
            int i;

            for (i = 0; i < _ScoreBoardLines; i++)
            {
                if (_FragSort[i] == Client.cl.viewentity - 1)
                {
                    break;
                }
            }

            if (i == _ScoreBoardLines) // we're not there
            {
                i = 0;
            }
            else // figure out start
            {
                i = i - numlines / 2;
            }

            if (i > _ScoreBoardLines - numlines)
            {
                i = _ScoreBoardLines - numlines;
            }
            if (i < 0)
            {
                i = 0;
            }

            int x = 324;

            for (; i < _ScoreBoardLines && y < Scr.vid.height - 8; i++)
            {
                int          k = _FragSort[i];
                scoreboard_t s = Client.cl.scores[k];
                if (String.IsNullOrEmpty(s.name))
                {
                    continue;
                }

                // draw background
                int top    = s.colors & 0xf0;
                int bottom = (s.colors & 15) << 4;
                top    = ColorForMap(top);
                bottom = ColorForMap(bottom);

                Drawer.Fill(x, y + 1, 40, 3, top);
                Drawer.Fill(x, y + 4, 40, 4, bottom);

                // draw number
                string num = s.frags.ToString().PadLeft(3);
                Drawer.DrawCharacter(x + 8, y, num[0]);
                Drawer.DrawCharacter(x + 16, y, num[1]);
                Drawer.DrawCharacter(x + 24, y, num[2]);

                if (k == Client.cl.viewentity - 1)
                {
                    Drawer.DrawCharacter(x, y, 16);
                    Drawer.DrawCharacter(x + 32, y, 17);
                }

                // draw name
                Drawer.DrawString(x + 48, y, s.name);

                y += 8;
            }
        }
Пример #2
0
        }                                     // sb_lines scan lines to draw


        // Sbar_Init
        public static void Init()
        {
            for (int i = 0; i < 10; i++)
            {
                string str = i.ToString();
                _Nums[0, i] = Drawer.PicFromWad("num_" + str);
                _Nums[1, i] = Drawer.PicFromWad("anum_" + str);
            }

            _Nums[0, 10] = Drawer.PicFromWad("num_minus");
            _Nums[1, 10] = Drawer.PicFromWad("anum_minus");

            _Colon = Drawer.PicFromWad("num_colon");
            _Slash = Drawer.PicFromWad("num_slash");

            _Weapons[0, 0] = Drawer.PicFromWad("inv_shotgun");
            _Weapons[0, 1] = Drawer.PicFromWad("inv_sshotgun");
            _Weapons[0, 2] = Drawer.PicFromWad("inv_nailgun");
            _Weapons[0, 3] = Drawer.PicFromWad("inv_snailgun");
            _Weapons[0, 4] = Drawer.PicFromWad("inv_rlaunch");
            _Weapons[0, 5] = Drawer.PicFromWad("inv_srlaunch");
            _Weapons[0, 6] = Drawer.PicFromWad("inv_lightng");

            _Weapons[1, 0] = Drawer.PicFromWad("inv2_shotgun");
            _Weapons[1, 1] = Drawer.PicFromWad("inv2_sshotgun");
            _Weapons[1, 2] = Drawer.PicFromWad("inv2_nailgun");
            _Weapons[1, 3] = Drawer.PicFromWad("inv2_snailgun");
            _Weapons[1, 4] = Drawer.PicFromWad("inv2_rlaunch");
            _Weapons[1, 5] = Drawer.PicFromWad("inv2_srlaunch");
            _Weapons[1, 6] = Drawer.PicFromWad("inv2_lightng");

            for (int i = 0; i < 5; i++)
            {
                string s = "inva" + (i + 1).ToString();
                _Weapons[2 + i, 0] = Drawer.PicFromWad(s + "_shotgun");
                _Weapons[2 + i, 1] = Drawer.PicFromWad(s + "_sshotgun");
                _Weapons[2 + i, 2] = Drawer.PicFromWad(s + "_nailgun");
                _Weapons[2 + i, 3] = Drawer.PicFromWad(s + "_snailgun");
                _Weapons[2 + i, 4] = Drawer.PicFromWad(s + "_rlaunch");
                _Weapons[2 + i, 5] = Drawer.PicFromWad(s + "_srlaunch");
                _Weapons[2 + i, 6] = Drawer.PicFromWad(s + "_lightng");
            }

            _Ammo[0] = Drawer.PicFromWad("sb_shells");
            _Ammo[1] = Drawer.PicFromWad("sb_nails");
            _Ammo[2] = Drawer.PicFromWad("sb_rocket");
            _Ammo[3] = Drawer.PicFromWad("sb_cells");

            _Armor[0] = Drawer.PicFromWad("sb_armor1");
            _Armor[1] = Drawer.PicFromWad("sb_armor2");
            _Armor[2] = Drawer.PicFromWad("sb_armor3");

            _Items[0] = Drawer.PicFromWad("sb_key1");
            _Items[1] = Drawer.PicFromWad("sb_key2");
            _Items[2] = Drawer.PicFromWad("sb_invis");
            _Items[3] = Drawer.PicFromWad("sb_invuln");
            _Items[4] = Drawer.PicFromWad("sb_suit");
            _Items[5] = Drawer.PicFromWad("sb_quad");

            _Sigil[0] = Drawer.PicFromWad("sb_sigil1");
            _Sigil[1] = Drawer.PicFromWad("sb_sigil2");
            _Sigil[2] = Drawer.PicFromWad("sb_sigil3");
            _Sigil[3] = Drawer.PicFromWad("sb_sigil4");

            _Faces[4, 0] = Drawer.PicFromWad("face1");
            _Faces[4, 1] = Drawer.PicFromWad("face_p1");
            _Faces[3, 0] = Drawer.PicFromWad("face2");
            _Faces[3, 1] = Drawer.PicFromWad("face_p2");
            _Faces[2, 0] = Drawer.PicFromWad("face3");
            _Faces[2, 1] = Drawer.PicFromWad("face_p3");
            _Faces[1, 0] = Drawer.PicFromWad("face4");
            _Faces[1, 1] = Drawer.PicFromWad("face_p4");
            _Faces[0, 0] = Drawer.PicFromWad("face5");
            _Faces[0, 1] = Drawer.PicFromWad("face_p5");

            _FaceInvis       = Drawer.PicFromWad("face_invis");
            _FaceInvuln      = Drawer.PicFromWad("face_invul2");
            _FaceInvisInvuln = Drawer.PicFromWad("face_inv2");
            _FaceQuad        = Drawer.PicFromWad("face_quad");

            Cmd.Add("+showscores", ShowScores);
            Cmd.Add("-showscores", DontShowScores);

            _SBar     = Drawer.PicFromWad("sbar");
            _IBar     = Drawer.PicFromWad("ibar");
            _ScoreBar = Drawer.PicFromWad("scorebar");

            //MED 01/04/97 added new hipnotic weapons
            if (Common.GameKind == GameKind.Hipnotic)
            {
                _HWeapons[0, 0] = Drawer.PicFromWad("inv_laser");
                _HWeapons[0, 1] = Drawer.PicFromWad("inv_mjolnir");
                _HWeapons[0, 2] = Drawer.PicFromWad("inv_gren_prox");
                _HWeapons[0, 3] = Drawer.PicFromWad("inv_prox_gren");
                _HWeapons[0, 4] = Drawer.PicFromWad("inv_prox");

                _HWeapons[1, 0] = Drawer.PicFromWad("inv2_laser");
                _HWeapons[1, 1] = Drawer.PicFromWad("inv2_mjolnir");
                _HWeapons[1, 2] = Drawer.PicFromWad("inv2_gren_prox");
                _HWeapons[1, 3] = Drawer.PicFromWad("inv2_prox_gren");
                _HWeapons[1, 4] = Drawer.PicFromWad("inv2_prox");

                for (int i = 0; i < 5; i++)
                {
                    string s = "inva" + (i + 1).ToString();
                    _HWeapons[2 + i, 0] = Drawer.PicFromWad(s + "_laser");
                    _HWeapons[2 + i, 1] = Drawer.PicFromWad(s + "_mjolnir");
                    _HWeapons[2 + i, 2] = Drawer.PicFromWad(s + "_gren_prox");
                    _HWeapons[2 + i, 3] = Drawer.PicFromWad(s + "_prox_gren");
                    _HWeapons[2 + i, 4] = Drawer.PicFromWad(s + "_prox");
                }

                _HItems[0] = Drawer.PicFromWad("sb_wsuit");
                _HItems[1] = Drawer.PicFromWad("sb_eshld");
            }

            if (Common.GameKind == GameKind.Rogue)
            {
                _RInvBar[0] = Drawer.PicFromWad("r_invbar1");
                _RInvBar[1] = Drawer.PicFromWad("r_invbar2");

                _RWeapons[0] = Drawer.PicFromWad("r_lava");
                _RWeapons[1] = Drawer.PicFromWad("r_superlava");
                _RWeapons[2] = Drawer.PicFromWad("r_gren");
                _RWeapons[3] = Drawer.PicFromWad("r_multirock");
                _RWeapons[4] = Drawer.PicFromWad("r_plasma");

                _RItems[0] = Drawer.PicFromWad("r_shield1");
                _RItems[1] = Drawer.PicFromWad("r_agrav1");

                // PGM 01/19/97 - team color border
                _RTeamBord = Drawer.PicFromWad("r_teambord");
                // PGM 01/19/97 - team color border

                _RAmmo[0] = Drawer.PicFromWad("r_ammolava");
                _RAmmo[1] = Drawer.PicFromWad("r_ammomulti");
                _RAmmo[2] = Drawer.PicFromWad("r_ammoplasma");
            }
        }
Пример #3
0
        // Sbar_Draw
        // called every frame by screen
        public static void Draw()
        {
            viddef_t vid = Scr.vid;

            if (Scr.ConCurrent == vid.height)
            {
                return;         // console is full screen
            }
            if (_Updates >= vid.numpages)
            {
                return;
            }

            Scr.CopyEverithing = true;

            _Updates++;

            if (Sbar.Lines > 0 && vid.width > 320)
            {
                Drawer.TileClear(0, vid.height - Sbar.Lines, vid.width, Sbar.Lines);
            }

            if (Sbar.Lines > 24)
            {
                DrawInventory();
                if (Client.cl.maxclients != 1)
                {
                    DrawFrags();
                }
            }

            client_state_t cl = Client.cl;

            if (_ShowScores || cl.stats[QStats.STAT_HEALTH] <= 0)
            {
                DrawPic(0, 0, _ScoreBar);
                DrawScoreboard();
                _Updates = 0;
            }
            else if (Sbar.Lines > 0)
            {
                DrawPic(0, 0, _SBar);

                // keys (hipnotic only)
                //MED 01/04/97 moved keys here so they would not be overwritten
                if (Common.GameKind == GameKind.Hipnotic)
                {
                    if (cl.HasItems(QItems.IT_KEY1))
                    {
                        DrawPic(209, 3, _Items[0]);
                    }
                    if (cl.HasItems(QItems.IT_KEY2))
                    {
                        DrawPic(209, 12, _Items[1]);
                    }
                }
                // armor
                if (cl.HasItems(QItems.IT_INVULNERABILITY))
                {
                    DrawNum(24, 0, 666, 3, 1);
                    DrawPic(0, 0, Drawer.Disc);
                }
                else
                {
                    if (Common.GameKind == GameKind.Rogue)
                    {
                        DrawNum(24, 0, cl.stats[QStats.STAT_ARMOR], 3, cl.stats[QStats.STAT_ARMOR] <= 25 ? 1 : 0); // uze: corrected color param
                        if (cl.HasItems(QItems.RIT_ARMOR3))
                        {
                            DrawPic(0, 0, _Armor[2]);
                        }
                        else if (cl.HasItems(QItems.RIT_ARMOR2))
                        {
                            DrawPic(0, 0, _Armor[1]);
                        }
                        else if (cl.HasItems(QItems.RIT_ARMOR1))
                        {
                            DrawPic(0, 0, _Armor[0]);
                        }
                    }
                    else
                    {
                        DrawNum(24, 0, cl.stats[QStats.STAT_ARMOR], 3, cl.stats[QStats.STAT_ARMOR] <= 25 ? 1 : 0);
                        if (cl.HasItems(QItems.IT_ARMOR3))
                        {
                            DrawPic(0, 0, _Armor[2]);
                        }
                        else if (cl.HasItems(QItems.IT_ARMOR2))
                        {
                            DrawPic(0, 0, _Armor[1]);
                        }
                        else if (cl.HasItems(QItems.IT_ARMOR1))
                        {
                            DrawPic(0, 0, _Armor[0]);
                        }
                    }
                }

                // face
                DrawFace();

                // health
                DrawNum(136, 0, cl.stats[QStats.STAT_HEALTH], 3, cl.stats[QStats.STAT_HEALTH] <= 25 ? 1 : 0);

                // ammo icon
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (cl.HasItems(QItems.RIT_SHELLS))
                    {
                        DrawPic(224, 0, _Ammo[0]);
                    }
                    else if (cl.HasItems(QItems.RIT_NAILS))
                    {
                        DrawPic(224, 0, _Ammo[1]);
                    }
                    else if (cl.HasItems(QItems.RIT_ROCKETS))
                    {
                        DrawPic(224, 0, _Ammo[2]);
                    }
                    else if (cl.HasItems(QItems.RIT_CELLS))
                    {
                        DrawPic(224, 0, _Ammo[3]);
                    }
                    else if (cl.HasItems(QItems.RIT_LAVA_NAILS))
                    {
                        DrawPic(224, 0, _RAmmo[0]);
                    }
                    else if (cl.HasItems(QItems.RIT_PLASMA_AMMO))
                    {
                        DrawPic(224, 0, _RAmmo[1]);
                    }
                    else if (cl.HasItems(QItems.RIT_MULTI_ROCKETS))
                    {
                        DrawPic(224, 0, _RAmmo[2]);
                    }
                }
                else
                {
                    if (cl.HasItems(QItems.IT_SHELLS))
                    {
                        DrawPic(224, 0, _Ammo[0]);
                    }
                    else if (cl.HasItems(QItems.IT_NAILS))
                    {
                        DrawPic(224, 0, _Ammo[1]);
                    }
                    else if (cl.HasItems(QItems.IT_ROCKETS))
                    {
                        DrawPic(224, 0, _Ammo[2]);
                    }
                    else if (cl.HasItems(QItems.IT_CELLS))
                    {
                        DrawPic(224, 0, _Ammo[3]);
                    }
                }

                DrawNum(248, 0, cl.stats[QStats.STAT_AMMO], 3, cl.stats[QStats.STAT_AMMO] <= 10 ? 1 : 0);
            }

            if (vid.width > 320)
            {
                if (Client.cl.gametype == Protocol.GAME_DEATHMATCH)
                {
                    MiniDeathmatchOverlay();
                }
            }
        }
Пример #4
0
        // Sbar_DrawFace
        static void DrawFace()
        {
            client_state_t cl = Client.cl;

            // PGM 01/19/97 - team color drawing
            // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
            if (Common.GameKind == GameKind.Rogue &&
                (Client.cl.maxclients != 1) &&
                (Host.TeamPlay > 3) &&
                (Host.TeamPlay < 7))
            {
                scoreboard_t s = cl.scores[cl.viewentity - 1];

                // draw background
                int top    = s.colors & 0xf0;
                int bottom = (s.colors & 15) << 4;
                top    = ColorForMap(top);
                bottom = ColorForMap(bottom);

                int xofs;
                if (cl.gametype == Protocol.GAME_DEATHMATCH)
                {
                    xofs = 113;
                }
                else
                {
                    xofs = ((Scr.vid.width - 320) >> 1) + 113;
                }

                DrawPic(112, 0, _RTeamBord);
                Drawer.Fill(xofs, Scr.vid.height - SBAR_HEIGHT + 3, 22, 9, top);
                Drawer.Fill(xofs, Scr.vid.height - SBAR_HEIGHT + 12, 22, 9, bottom);

                // draw number
                string num = s.frags.ToString().PadLeft(3);
                if (top == 8)
                {
                    if (num[0] != ' ')
                    {
                        DrawCharacter(109, 3, 18 + num[0] - '0');
                    }
                    if (num[1] != ' ')
                    {
                        DrawCharacter(116, 3, 18 + num[1] - '0');
                    }
                    if (num[2] != ' ')
                    {
                        DrawCharacter(123, 3, 18 + num[2] - '0');
                    }
                }
                else
                {
                    DrawCharacter(109, 3, num[0]);
                    DrawCharacter(116, 3, num[1]);
                    DrawCharacter(123, 3, num[2]);
                }

                return;
            }
            // PGM 01/19/97 - team color drawing

            int f, anim;

            if (cl.HasItems(QItems.IT_INVISIBILITY | QItems.IT_INVULNERABILITY))
            {
                DrawPic(112, 0, _FaceInvisInvuln);
                return;
            }
            if (cl.HasItems(QItems.IT_QUAD))
            {
                DrawPic(112, 0, _FaceQuad);
                return;
            }
            if (cl.HasItems(QItems.IT_INVISIBILITY))
            {
                DrawPic(112, 0, _FaceInvis);
                return;
            }
            if (cl.HasItems(QItems.IT_INVULNERABILITY))
            {
                DrawPic(112, 0, _FaceInvuln);
                return;
            }

            if (cl.stats[QStats.STAT_HEALTH] >= 100)
            {
                f = 4;
            }
            else
            {
                f = cl.stats[QStats.STAT_HEALTH] / 20;
            }

            if (cl.time <= cl.faceanimtime)
            {
                anim     = 1;
                _Updates = 0; // make sure the anim gets drawn over
            }
            else
            {
                anim = 0;
            }

            DrawPic(112, 0, _Faces[f, anim]);
        }
Пример #5
0
        private static msurface_t _WarpFace; // used by SubdivideSurface()

        /// <summary>
        /// R_InitSky
        /// called at level load
        /// A sky texture is 256*128, with the right side being a masked overlay
        /// </summary>
        public static void InitSky(texture_t mt)
        {
            byte[] src    = mt.pixels;
            int    offset = mt.offsets[0];

            // make an average value for the back to avoid
            // a fringe on the top level
            const int size = 128 * 128;

            uint[]  trans  = new uint[size];
            uint[]  v8to24 = vid.Table8to24;
            int     r      = 0;
            int     g      = 0;
            int     b      = 0;
            Union4b rgba   = Union4b.Empty;

            for (int i = 0; i < 128; i++)
            {
                for (int j = 0; j < 128; j++)
                {
                    int p = src[offset + i * 256 + j + 128];
                    rgba.ui0             = v8to24[p];
                    trans[(i * 128) + j] = rgba.ui0;
                    r += rgba.b0;
                    g += rgba.b1;
                    b += rgba.b2;
                }
            }

            rgba.b0 = (byte)(r / size);
            rgba.b1 = (byte)(g / size);
            rgba.b2 = (byte)(b / size);
            rgba.b3 = 0;

            uint transpix = rgba.ui0;

            if (_SolidSkyTexture == 0)
            {
                _SolidSkyTexture = Drawer.GenerateTextureNumber();
            }
            Drawer.Bind(_SolidSkyTexture);
            GL.TexImage2D(TextureTarget.Texture2D, 0, Drawer.SolidFormat, 128, 128, 0, PixelFormat.Rgba, PixelType.UnsignedByte, trans);
            Drawer.SetTextureFilters(TextureMinFilter.Linear, TextureMagFilter.Linear);

            for (int i = 0; i < 128; i++)
            {
                for (int j = 0; j < 128; j++)
                {
                    int p = src[offset + i * 256 + j];
                    if (p == 0)
                    {
                        trans[(i * 128) + j] = transpix;
                    }
                    else
                    {
                        trans[(i * 128) + j] = v8to24[p];
                    }
                }
            }

            if (_AlphaSkyTexture == 0)
            {
                _AlphaSkyTexture = Drawer.GenerateTextureNumber();
            }
            Drawer.Bind(_AlphaSkyTexture);
            GL.TexImage2D(TextureTarget.Texture2D, 0, Drawer.AlphaFormat, 128, 128, 0, PixelFormat.Rgba, PixelType.UnsignedByte, trans);
            Drawer.SetTextureFilters(TextureMinFilter.Linear, TextureMagFilter.Linear);
        }