]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
more Nexuiz hud stuff from BlackHC, minor style edits to fit in with surrounding...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 14 Sep 2003 03:52:21 +0000 (03:52 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 14 Sep 2003 03:52:21 +0000 (03:52 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3459 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
client.h
quakedef.h
sbar.c
sv_main.c

index 38de3397371a68e4c877cb6478c2139ced42c77c..c208a7b9accc5867903cb03e25d2f03b4ed8b4a2 100644 (file)
@@ -807,11 +807,12 @@ void CL_ParseClientdata (int bits)
        cl.stats[STAT_CELLS] = MSG_ReadByte();
 
        i = MSG_ReadByte ();
-
-       if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
-               cl.stats[STAT_ACTIVEWEAPON] = (1<<i);
-       else
-               cl.stats[STAT_ACTIVEWEAPON] = i;
+       if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE || gamemode == GAME_NEXUIZ)
+               i = (1<<i);
+       // GAME_NEXUIZ hud needs weapon change time
+       if (cl.stats[STAT_ACTIVEWEAPON] != i)
+               cl.weapontime = cl.time;
+       cl.stats[STAT_ACTIVEWEAPON] = i;
 
        cl.viewzoomold = cl.viewzoomnew; // for interpolation
        if (bits & SU_VIEWZOOM)
index 88b75241123e5c4f198429e447d033e907fe9419..43aa005bd0e9feab61cd2e1ac77eaa67e9a68d75 100644 (file)
--- a/client.h
+++ b/client.h
@@ -328,6 +328,8 @@ typedef struct
        int items;
        // cl.time of acquiring item, for blinking
        float item_gettime[32];
+       // cl.time of changing STAT_ACTIVEWEAPON
+       float weapontime;
        // use pain anim frame if cl.time < this
        float faceanimtime;
 
index a7c356203134a23a36b476100985aa296d11e90d..7ea3acb68a2059bffa000618d682a1230696209c 100644 (file)
@@ -117,22 +117,23 @@ extern char *buildstring;
 //===========================================
 // AK nexuiz changed and added defines
 
-#define NEX_IT_UZI                                     1
-#define NEX_IT_SHOTGUN                         2
-#define NEX_IT_ELECTRO                         8
-#define NEX_IT_CRYLINK                         16
-#define NEX_IT_NEX                                     32
-#define NEX_IT_HAGAR                           64
-#define NEX_IT_ROCKET_LAUNCHER         128
-#define NEX_IT_SHELLS                          256
-#define NEX_IT_BULLETS                         512
-#define NEX_IT_ROCKETS                         1024
-#define NEX_IT_CELLS                           2048
-#define NEX_IT_LASER                           4094
-#define NEX_IT_STRENGTH                        8192
-#define NEX_IT_INVINCIBLE                      16384
-#define NEX_IT_SPEED                           32767
-#define NEX_IT_SLOWMO                          65536
+#define NEX_IT_UZI              1
+#define NEX_IT_SHOTGUN          2
+#define NEX_IT_GRENADE_LAUNCHER 4
+#define NEX_IT_ELECTRO          8
+#define NEX_IT_CRYLINK          16
+#define NEX_IT_NEX              32
+#define NEX_IT_HAGAR            64
+#define NEX_IT_ROCKET_LAUNCHER  128
+#define NEX_IT_SHELLS           256
+#define NEX_IT_BULLETS          512
+#define NEX_IT_ROCKETS          1024
+#define NEX_IT_CELLS            2048
+#define NEX_IT_LASER            4094
+#define NEX_IT_STRENGTH         8192
+#define NEX_IT_INVINCIBLE       16384
+#define NEX_IT_SPEED            32768
+#define NEX_IT_SLOWMO           65536
 
 //===========================================
 //rogue changed and added defines
diff --git a/sbar.c b/sbar.c
index 5c8dcefb02643449fc2637e513e38c577ed9cdd5..f98d4de46ab15aa9be912bbbbf5c4ba465be7cd2 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -50,7 +50,8 @@ sbarpic_t *sb_scorebar;
 // AK only used by NEX(and only if everybody agrees)
 sbarpic_t *sb_sbar_overlay;
 
-sbarpic_t *sb_weapons[7][8]; // 0 is active, 1 is owned, 2-5 are flashes
+// AK changed the bound to 9
+sbarpic_t *sb_weapons[7][9]; // 0 is active, 1 is owned, 2-5 are flashes
 sbarpic_t *sb_ammo[4];
 sbarpic_t *sb_sigil[4];
 sbarpic_t *sb_armor[3];
@@ -152,6 +153,9 @@ void sbar_start(void)
                sb_sbar = Sbar_NewPic("gfx/sbar");
                sb_sbar_overlay = Sbar_NewPic("gfx/sbar_overlay");
 
+               for(i = 0; i < 9;i++)
+                       sb_weapons[0][i] = Sbar_NewPic(va("gfx/inv_weapon%i",i));
+
                return;
        }
 
@@ -444,6 +448,20 @@ void Sbar_DrawScoreboard (void)
 
 //=============================================================================
 
+// AK to make DrawInventory smaller
+static void Sbar_DrawWeapon(int nr, float fade, int active)
+{
+       // width = 300, height = 100
+       const int w_width = 300, w_height = 100, w_space = 10, font_size = 10;
+       const float w_scale = 0.4;
+
+       DrawQ_Pic(vid.conwidth - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr]->name, w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade, DRAWFLAG_ADDITIVE);
+       DrawQ_String(vid.conwidth - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0);
+
+       if (active)
+               DrawQ_Fill(vid.conwidth - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade, DRAWFLAG_ADDITIVE);
+}
+
 /*
 ===============
 Sbar_DrawInventory
@@ -451,10 +469,34 @@ Sbar_DrawInventory
 */
 void Sbar_DrawInventory (void)
 {
-       int             i;
-       char    num[6];
-       float   time;
-       int             flashon;
+       int i;
+       char num[6];
+       float time;
+       int flashon;
+       // AK 2003
+       float fade;
+
+       if(gamemode == GAME_NEXUIZ)
+       {
+               num[0] = cl.stats[STAT_ACTIVEWEAPON];
+               // we have a max time 2s (min time = 0)
+               if ((time = cl.time - cl.weapontime) > 2)
+                       return;
+
+               fade = (1.0 - 0.5 * time);
+               fade *= fade;
+               for (i = 0; i < 8;i++)
+               {
+                       if (!(cl.items & (1 << i)))
+                               continue;
+                       Sbar_DrawWeapon(i + 1, fade, (i == num[0]));
+               }
+
+               if(!(cl.items & (1<<12)))
+                       return;
+               Sbar_DrawWeapon(0, fade, (num[0] == 12));
+               return;
+       }
 
        if (gamemode == GAME_ROGUE)
        {
@@ -791,16 +833,13 @@ void Sbar_Draw (void)
                return;
        }
 
-       if(gamemode == GAME_NEXUIZ)
+       if (gamemode == GAME_NEXUIZ)
        {
                sbar_y = vid.conheight - 47;
                sbar_x = (vid.conwidth - 640)/2;
 
                if (sb_lines > 24)
-               {
-                       if (!cl.islocalgame)
-                               Sbar_DrawFrags ();
-               }
+                       Sbar_DrawFrags ();
 
                if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
                {
@@ -838,12 +877,7 @@ void Sbar_Draw (void)
 
                        //Sbar_DrawAlphaPic(0,0,sb_sbar_overlay,0.5);
                        DrawQ_Pic(sbar_x,sbar_y,sb_sbar_overlay->name,0,0,1,1,1,1,DRAWFLAG_MODULATE);
-
                }
-
-               if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
-                       Sbar_MiniDeathmatchOverlay ();
-
        }
        else
        {
index df5dd14132ae9ad27cb4b2022bee9a7d76800cf2..109f87ff514bee9272604642485eaa673f20f498 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1275,7 +1275,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
        MSG_WriteByte (msg, ent->v->ammo_rockets);
        MSG_WriteByte (msg, ent->v->ammo_cells);
 
-       if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
+       if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE || gamemode == GAME_NEXUIZ)
        {
                for(i=0;i<32;i++)
                {