]> git.xolatile.top Git - xolatile-badassbug.git/commitdiff
New menu, overlapping for now...
authorxolatile <xolatile@proton.me>
Fri, 25 Jul 2025 00:27:37 +0000 (02:27 +0200)
committerxolatile <xolatile@proton.me>
Fri, 25 Jul 2025 00:27:37 +0000 (02:27 +0200)
src/fpsgame/fps.cpp

index 885bb3af01d78a58272d3c533f7d2e5e085a8ed5..fceb94a125c4c758a2ad95808f3c8a5380f075ba 100644 (file)
@@ -1068,8 +1068,169 @@ namespace game
         pophudmatrix();
     }
 
+    void newhud(int w, int h) //new SauerEnhanced HUD
+    {
+        if(player1->state==CS_DEAD || player1->state==CS_SPECTATOR) return;
+        //~glPushMatrix();
+        //~glScalef(1/1.2f, 1/1.2f, 1);
+        pushhudmatrix();
+        //~hudmatrix.scale(w/1800.0f, h/1650.0f, 1);
+        hudmatrix.scale(1.0f/1.2f, 1.0f/1.2f, 1);
+        flushhudmatrix();
+        if(!m_insta) draw_textf("%d", 80, h*1.2f-128, player1->state==CS_DEAD ? 0 : player1->health);
+        defformatstring(ammo, "%d", player1->ammo[player1->gunselect]);
+        int wb, hb;
+        text_bounds(ammo, wb, hb);
+        draw_textf("%d", w*1.2f-wb-80, h*1.2f-128, player1->ammo[player1->gunselect]);
+
+            //~hudmatrix.ortho(0, w, h, 0, -1, 1);
+            //~resethudmatrix();
+
+            //~hudshader->set();
+            gle::colorf(1, 1, 1);
+
+            gle::defvertex(2);
+            gle::deftexcoord0();
+
+        if(player1->quadmillis)
+        {
+            //~gle::begin(GL_QUADS);
+            //~loopj(numdecals)
+            //~{
+                //~float hsz = decals[j].size, hx = clamp(decals[j].x, hsz, w-hsz), hy = clamp(decals[j].y, hsz, h-hsz), side = decals[j].side;
+                //~gle::attribf(hx-hsz, hy-hsz); gle::attribf(side,   0);
+                //~gle::attribf(hx+hsz, hy-hsz); gle::attribf(1-side, 0);
+                //~gle::attribf(hx+hsz, hy+hsz); gle::attribf(1-side, 1);
+                //~gle::attribf(hx-hsz, hy+hsz); gle::attribf(side,   1);
+            //~}
+            //~gle::end();
+            settexture("packages/hud/hud_quaddamage_left.png");  //QuadDamage left glow
+            gle::begin(GL_QUADS);
+            gle::attribf(0,   h*1.2f-207);       gle::attribf(0.0f, 0.0f);
+            gle::attribf(539, h*1.2f-207);       gle::attribf(1.0f, 0.0f);
+            gle::attribf(539, h*1.2f);       gle::attribf(1.0f, 1.0f);
+            gle::attribf(0,   h*1.2f);       gle::attribf(0.0f, 1.0f);
+            gle::end();
+
+            settexture("packages/hud/hud_quaddamage_right.png"); //QuadDamage right glow
+            gle::begin(GL_QUADS);
+            gle::attribf(w*1.2f-135, h*1.2f-207);          gle::attribf(0.0f, 0.0f);
+            gle::attribf(w*1.2f,     h*1.2f-207);          gle::attribf(1.0f, 0.0f);
+            gle::attribf(w*1.2f,     h*1.2f);          gle::attribf(1.0f, 1.0f);
+            gle::attribf(w*1.2f-135, h*1.2f);          gle::attribf(0.0f, 1.0f);
+            gle::end();
+        }
+
+        if(player1->maxhealth > 100)
+        {
+            settexture("packages/hud/hud_megahealth.png");  //HealthBoost indicator
+            gle::begin(GL_QUADS);
+            gle::attribf(0,   h*1.2f-207);           gle::attribf(0.0f, 0.0f);
+            gle::attribf(539, h*1.2f-207);           gle::attribf(1.0f, 0.0f);
+            gle::attribf(539, h*1.2f);           gle::attribf(1.0f, 1.0f);
+            gle::attribf(0,   h*1.2f);           gle::attribf(0.0f, 1.0f);
+            gle::end();
+        }
+
+        int health = (player1->health*100)/player1->maxhealth,
+            armour = (player1->armour*100)/200,
+            hh = (health*101)/100,
+            ah = (armour*167)/100;
+
+        float hs = (health*1.0f)/100,
+              as = (armour*1.0f)/100;
+
+        if(player1->health > 0 && !m_insta)
+        {
+            settexture("packages/hud/hud_health.png");  //Health bar
+            gle::begin(GL_QUADS);
+            gle::attribf(47, h*1.2f-hh-56);            gle::attribf(0.0f, 1.0f-hs);
+            gle::attribf(97, h*1.2f-hh-56);            gle::attribf(1.0f, 1.0f-hs);
+            gle::attribf(97, h*1.2f-57);            gle::attribf(1.0f, 1.0f);
+            gle::attribf(47, h*1.2f-57);            gle::attribf(0.0f, 1.0f);
+            gle::end();
+        }
+
+        if(player1->armour > 0)
+        {
+            settexture("packages/hud/hud_armour.png");  //Armour bar
+            gle::begin(GL_QUADS);
+            gle::attribf(130,    h*1.2f-62);gle::attribf(0.0f,    0.0f);
+            gle::attribf(130+ah, h*1.2f-62);gle::attribf(as,      0.0f);
+            gle::attribf(130+ah, h*1.2f-44);gle::attribf(as,      1.0f);
+            gle::attribf(130,    h*1.2f-44);gle::attribf(0.0f,    1.0f);
+            gle::end();
+        }
+
+        if(!m_insta)
+        {
+            settexture("packages/hud/hud_left.png"); //left HUD
+            gle::begin(GL_QUADS);
+            gle::attribf(0,   h*1.2f-207);gle::attribf(0.0f, 0.0f);
+            gle::attribf(539, h*1.2f-207);gle::attribf(1.0f, 0.0f);
+            gle::attribf(539, h*1.2f    );gle::attribf(1.0f, 1.0f);
+            gle::attribf(0,   h*1.2f    );gle::attribf(0.0f, 1.0f);
+            gle::end();
+        }
+
+        settexture("packages/hud/hud_right.png"); //right HUD
+            gle::begin(GL_QUADS);
+        gle::attribf(w*1.2f-135, h*1.2f-207);gle::attribf(0.0f, 0.0f);
+        gle::attribf(w*1.2f,     h*1.2f-207);gle::attribf(1.0f, 0.0f);
+        gle::attribf(w*1.2f,     h*1.2f    );gle::attribf(1.0f, 1.0f);
+        gle::attribf(w*1.2f-135, h*1.2f    );gle::attribf(0.0f, 1.0f);
+            gle::end();
+
+        int maxammo = 0;
+
+        switch(player1->gunselect)
+        {
+            case GUN_FIST:
+                maxammo = 1;
+                break;
+
+            case GUN_RL:
+            case GUN_RIFLE:
+                maxammo = m_insta ? 100 : 15;
+                break;
+
+            case GUN_SG:
+            case GUN_GL:
+                maxammo = 30;
+                break;
+
+            case GUN_CG:
+                maxammo = 60;
+                break;
+
+            case GUN_PISTOL:
+                maxammo = 120;
+                break;
+        }
+
+        int curammo = (player1->ammo[player1->gunselect]*100)/maxammo,
+            amh = (curammo*101)/100;
+
+        float ams = (curammo*1.0f)/100;
+
+        if(player1->ammo[player1->gunselect] > 0)
+        {
+            settexture("packages/hud/hud_health.png");  //Ammo bar
+            gle::begin(GL_QUADS);
+            gle::attribf(w*1.2f-47, h*1.2f-amh-56);gle::attribf(0.0f, 1.0f-ams);
+            gle::attribf(w*1.2f-97, h*1.2f-amh-56);gle::attribf(1.0f, 1.0f-ams);
+            gle::attribf(w*1.2f-97, h*1.2f-57    );gle::attribf(1.0f, 1.0f);
+            gle::attribf(w*1.2f-47, h*1.2f-57    );gle::attribf(0.0f, 1.0f);
+            gle::end();
+        }
+        //~glPopMatrix();
+        pophudmatrix();
+    }
+
     void gameplayhud(int w, int h)
     {
+        newhud(w, h);
+
         pushhudmatrix();
         hudmatrix.scale(h/1800.0f, h/1800.0f, 1);
         flushhudmatrix();