]> git.xolatile.top Git - xolatile-badassbug.git/commitdiff
Hacked up speedometer and accelerated movement...
authorxolatile <xolatile@proton.me>
Wed, 23 Jul 2025 20:38:43 +0000 (22:38 +0200)
committerxolatile <xolatile@proton.me>
Wed, 23 Jul 2025 20:38:43 +0000 (22:38 +0200)
src/engine/main.cpp
src/engine/physics.cpp
src/engine/rendergl.cpp
src/fpsgame/fps.cpp
src/shared/cube.h

index c7a88cf6d0f5824d8be04556885ddeb79f11c64c..40ef42a96b5006e99fe7558c36afd4faced74a7f 100644 (file)
@@ -6,6 +6,8 @@
 #include "SDL_syswm.h"
 #endif
 
+float speedmodifier = 0.0f;
+
 extern void cleargamma();
 
 void cleanup()
index 4a30130f417663134979dfe33d48a413394cf5ab..4c237390627d3e7546ad5cfa4d07bbe61e91a133 100644 (file)
@@ -1631,7 +1631,10 @@ void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curt
     }
 
     vec d(m);
-    d.mul(pl->maxspeed);
+    speedmodifier*=(pl->physstate!=PHYS_FLOOR)*(speedmodifier>0);
+    speedmodifier=(speedmodifier>100.0f)?100.0f:speedmodifier;
+    d.mul(pl->maxspeed + speedmodifier);
+
     if(pl->type==ENT_PLAYER)
     {
         if(floating)
index 9b7c35f505be034272a7f97f50dd8f961433de6f..f6d19b9ac14189e5d940e2c85a43a613d6e88c3c 100644 (file)
@@ -815,6 +815,7 @@ void mousemove(int dx, int dy)
         player->yaw = camera1->yaw;
         player->pitch = camera1->pitch;
     }
+    speedmodifier += abs(dx)-abs(dy);
 }
 
 void recomputecamera()
index 377afa3211709aa2e8e0cd3885b1e083f3853bf6..038fe47f1a7b669395fe5142bf0c4d7d327e1b1a 100644 (file)
@@ -876,6 +876,8 @@ namespace game
 
     void drawhudicons(fpsent *d)
     {
+        int speedforreal = (int) (sqrtf(d->vel.squaredlen()) + /*speedmodifier*/ + 1.0f);
+
         pushhudmatrix();
         hudmatrix.scale(2, 2, 1);
         flushhudmatrix();
@@ -887,6 +889,8 @@ namespace game
         {
             if(d->armour) draw_textf("%d", (HICON_X + HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->armour);
             draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->ammo[d->gunselect]);
+            //~draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2+800, HICON_TEXTY/2, (int) (100.0f+speedmodifier));
+            draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2+400, HICON_TEXTY/2, speedforreal);
         }
 
         pophudmatrix();
@@ -981,7 +985,7 @@ namespace game
         flushhudmatrix();
 
         defformatstring(label, "%d", p->ammo[gun]);
-        int tw, th, moved, movew = 0, moveh = 0; text_bounds(label, tw, th);
+        int tw, th; text_bounds(label, tw, th);
         vec2 textdrawpos = vec2(-tw, -th).div(2);
         float ammoratio = (float)p->ammo[gun] / itemstats[gun-GUN_SG].add;
         bvec color = bvec::hexcolor(p->ammo[gun] == 0 || ammoratio >= 1.0f ? 0xFFFFFF : (ammoratio >= 0.5f ? 0xFFC040 : 0xFF0000));
index ed1c207bb8809aa7c276f3caa3f73862fe6c0aae..ffb1d1bdde013d0d0bb2b11b704558dc2c094456 100644 (file)
@@ -66,3 +66,4 @@
 
 #endif
 
+extern float speedmodifier;