예제 #1
0
파일: Sbar.cs 프로젝트: Scrama/Quarp
        // Sbar_DrawFrags
        static void DrawFrags()
        {
            SortFrags();

            // draw the text
            int            l = _ScoreBoardLines <= 4 ? _ScoreBoardLines : 4;
            int            xofs, x = 23;
            client_state_t cl = Client.cl;

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

            int y = Scr.vid.height - SBAR_HEIGHT - 23;

            for (int i = 0; i < l; i++)
            {
                int          k = _FragSort[i];
                scoreboard_t s = 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(xofs + x * 8 + 10, y, 28, 4, top);
                Drawer.Fill(xofs + x * 8 + 10, y + 4, 28, 3, bottom);

                // draw number
                int    f   = s.frags;
                string num = f.ToString().PadLeft(3);
                //sprintf(num, "%3i", f);

                DrawCharacter((x + 1) * 8, -24, num[0]);
                DrawCharacter((x + 2) * 8, -24, num[1]);
                DrawCharacter((x + 3) * 8, -24, num[2]);

                if (k == cl.viewentity - 1)
                {
                    DrawCharacter(x * 8 + 2, -24, 16);
                    DrawCharacter((x + 4) * 8 - 4, -24, 17);
                }
                x += 4;
            }
        }
예제 #2
0
파일: Sbar.cs 프로젝트: Scrama/Quarp
        // Sbar_DeathmatchOverlay
        static void DeathmatchOverlay()
        {
            Scr.CopyEverithing = true;
            Scr.FullUpdate     = 0;

            glpic_t pic = Drawer.CachePic("gfx/ranking.lmp");

            Menu.DrawPic((320 - pic.width) / 2, 8, pic);

            // scores
            SortFrags();

            // draw the text
            int l = _ScoreBoardLines;

            int x = 80 + ((Scr.vid.width - 320) >> 1);
            int y = 40;

            for (int i = 0; i < l; 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, 40, 4, 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 - 8, y, 12);
                }

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

                y += 10;
            }
        }
예제 #3
0
파일: Sbar.cs 프로젝트: Scrama/Quarp
        // 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;
            }
        }
예제 #4
0
파일: Sbar.cs 프로젝트: Scrama/Quarp
        // 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]);
        }