Пример #1
0
        // V_CalcPowerupCshift
        static void CalcPowerupCshift()
        {
            ClientState cl = Client.Cl;

            if (cl.HasItems(QItems.IT_QUAD))
            {
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[0] = 0;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[1] = 0;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[2] = 255;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].percent      = 30;
            }
            else if (cl.HasItems(QItems.IT_SUIT))
            {
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[0] = 0;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[1] = 255;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[2] = 0;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].percent      = 20;
            }
            else if (cl.HasItems(QItems.IT_INVISIBILITY))
            {
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[0] = 100;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[1] = 100;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[2] = 100;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].percent      = 100;
            }
            else if (cl.HasItems(QItems.IT_INVULNERABILITY))
            {
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[0] = 255;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[1] = 255;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].destcolor[2] = 0;
                cl.cshifts[ColorShift.CSHIFT_POWERUP].percent      = 30;
            }
            else
            {
                cl.cshifts[ColorShift.CSHIFT_POWERUP].percent = 0;
            }
        }
Пример #2
0
        // Sbar_DrawFace
        static void DrawFace()
        {
            ClientState 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 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]);
        }
Пример #3
0
        // Sbar_DrawInventory
        static void DrawInventory()
        {
            int flashon;

            ClientState cl = Client.Cl;

            if (Common.GameKind == GameKind.Rogue)
            {
                if (cl.stats[QStats.STAT_ACTIVEWEAPON] >= QItems.RIT_LAVA_NAILGUN)
                {
                    DrawPic(0, -24, _RInvBar[0]);
                }
                else
                {
                    DrawPic(0, -24, _RInvBar[1]);
                }
            }
            else
            {
                DrawPic(0, -24, _IBar);
            }

            // weapons
            for (int i = 0; i < 7; i++)
            {
                if (cl.HasItems(QItems.IT_SHOTGUN << i))
                {
                    float time = cl.item_gettime[i];
                    flashon = (int)((cl.time - time) * 10);
                    if (flashon >= 10)
                    {
                        if (cl.stats[QStats.STAT_ACTIVEWEAPON] == (QItems.IT_SHOTGUN << i))
                        {
                            flashon = 1;
                        }
                        else
                        {
                            flashon = 0;
                        }
                    }
                    else
                    {
                        flashon = (flashon % 5) + 2;
                    }

                    DrawPic(i * 24, -16, _Weapons[flashon, i]);

                    if (flashon > 1)
                    {
                        _Updates = 0; // force update to remove flash
                    }
                }
            }

            // MED 01/04/97
            // hipnotic weapons
            if (Common.GameKind == GameKind.Hipnotic)
            {
                int grenadeflashing = 0;
                for (int i = 0; i < 4; i++)
                {
                    if (cl.HasItems(1 << _HipWeapons[i]))
                    {
                        float time = cl.item_gettime[_HipWeapons[i]];
                        flashon = (int)((cl.time - time) * 10);
                        if (flashon >= 10)
                        {
                            if (cl.stats[QStats.STAT_ACTIVEWEAPON] == (1 << _HipWeapons[i]))
                            {
                                flashon = 1;
                            }
                            else
                            {
                                flashon = 0;
                            }
                        }
                        else
                        {
                            flashon = (flashon % 5) + 2;
                        }

                        // check grenade launcher
                        if (i == 2)
                        {
                            if (cl.HasItems(QItems.HIT_PROXIMITY_GUN))
                            {
                                if (flashon > 0)
                                {
                                    grenadeflashing = 1;
                                    DrawPic(96, -16, _HWeapons[flashon, 2]);
                                }
                            }
                        }
                        else if (i == 3)
                        {
                            if (cl.HasItems(QItems.IT_SHOTGUN << 4))
                            {
                                if (flashon > 0 && grenadeflashing == 0)
                                {
                                    DrawPic(96, -16, _HWeapons[flashon, 3]);
                                }
                                else if (grenadeflashing == 0)
                                {
                                    DrawPic(96, -16, _HWeapons[0, 3]);
                                }
                            }
                            else
                            {
                                DrawPic(96, -16, _HWeapons[flashon, 4]);
                            }
                        }
                        else
                        {
                            DrawPic(176 + (i * 24), -16, _HWeapons[flashon, i]);
                        }

                        if (flashon > 1)
                        {
                            _Updates = 0; // force update to remove flash
                        }
                    }
                }
            }

            if (Common.GameKind == GameKind.Rogue)
            {
                // check for powered up weapon.
                if (cl.stats[QStats.STAT_ACTIVEWEAPON] >= QItems.RIT_LAVA_NAILGUN)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        if (cl.stats[QStats.STAT_ACTIVEWEAPON] == (QItems.RIT_LAVA_NAILGUN << i))
                        {
                            DrawPic((i + 2) * 24, -16, _RWeapons[i]);
                        }
                    }
                }
            }

            // ammo counts
            for (int i = 0; i < 4; i++)
            {
                string num = cl.stats[QStats.STAT_SHELLS + i].ToString().PadLeft(3);
                //sprintf(num, "%3i", cl.stats[QStats.STAT_SHELLS + i]);
                if (num[0] != ' ')
                {
                    DrawCharacter((6 * i + 1) * 8 - 2, -24, 18 + num[0] - '0');
                }

                if (num[1] != ' ')
                {
                    DrawCharacter((6 * i + 2) * 8 - 2, -24, 18 + num[1] - '0');
                }

                if (num[2] != ' ')
                {
                    DrawCharacter((6 * i + 3) * 8 - 2, -24, 18 + num[2] - '0');
                }
            }

            flashon = 0;
            // items
            for (int i = 0; i < 6; i++)
            {
                if (cl.HasItems(1 << (17 + i)))
                {
                    float time = cl.item_gettime[17 + i];
                    if (time > 0 && time > cl.time - 2 && flashon > 0)
                    {  // flash frame
                        _Updates = 0;
                    }
                    else
                    {
                        //MED 01/04/97 changed keys
                        if (Common.GameKind != GameKind.Hipnotic || (i > 1))
                        {
                            DrawPic(192 + i * 16, -16, _Items[i]);
                        }
                    }
                    if (time > 0 && time > cl.time - 2)
                    {
                        _Updates = 0;
                    }
                }
            }

            //MED 01/04/97 added hipnotic items
            // hipnotic items
            if (Common.GameKind == GameKind.Hipnotic)
            {
                for (int i = 0; i < 2; i++)
                {
                    if (cl.HasItems(1 << (24 + i)))
                    {
                        float time = cl.item_gettime[24 + i];
                        if (time > 0 && time > cl.time - 2 && flashon > 0)
                        {  // flash frame
                            _Updates = 0;
                        }
                        else
                        {
                            DrawPic(288 + i * 16, -16, _HItems[i]);
                        }
                        if (time > 0 && time > cl.time - 2)
                        {
                            _Updates = 0;
                        }
                    }
                }
            }

            if (Common.GameKind == GameKind.Rogue)
            {
                // new rogue items
                for (int i = 0; i < 2; i++)
                {
                    if (cl.HasItems(1 << (29 + i)))
                    {
                        float time = cl.item_gettime[29 + i];

                        if (time > 0 && time > cl.time - 2 && flashon > 0)
                        {       // flash frame
                            _Updates = 0;
                        }
                        else
                        {
                            DrawPic(288 + i * 16, -16, _RItems[i]);
                        }

                        if (time > 0 && time > cl.time - 2)
                        {
                            _Updates = 0;
                        }
                    }
                }
            }
            else
            {
                // sigils
                for (int i = 0; i < 4; i++)
                {
                    if (cl.HasItems(1 << (28 + i)))
                    {
                        float time = cl.item_gettime[28 + i];
                        if (time > 0 && time > cl.time - 2 && flashon > 0)
                        {       // flash frame
                            _Updates = 0;
                        }
                        else
                        {
                            DrawPic(320 - 32 + i * 8, -16, _Sigil[i]);
                        }

                        if (time > 0 && time > cl.time - 2)
                        {
                            _Updates = 0;
                        }
                    }
                }
            }
        }
Пример #4
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();
                }
            }

            ClientState 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();
                }
            }
        }