Radar Modes: now a reality

Radar Modes: now a reality

Postby greaserpirate » 19 Jun 2012, 04:32

I'm happy to announce that I've completed (for now) my mission to make new styles of radar.

Here's the code, if you don't want to look through the files:

In src/game/hud.cpp, on line 1462, add this:

{l Code}: {l Select All Code}
if (GAME(radarmode) == 2) //Greaser's idea
      {
         if (d->actiontime[0] > d->actiontime[1])
         {
            if (d->actiontime[0] > d->actiontime[2])
            {
               fade = 1 - ((lastmillis - d->actiontime[0]) * 0.001); //fade over time after a player shoots (primary)
            }
            else
            {
               fade = 1 - ((lastmillis - d->actiontime[2]) * 0.001); //fade over time after a player reloads
            }
         }
         else
         {
            if (d->actiontime[1] > d->actiontime[2])
            {
               fade = 1 - ((lastmillis - d->actiontime[1]) * 0.001); //fade over time after a player shoots (2ndary)
            }
            else
            {
               fade = 1 - ((lastmillis - d->actiontime[2]) * 0.001); //fade over time after a player reloads
            }
         }
      }
      else if (GAME(radarmode) == 3) //Riidom's idea (inverted)
      {   
                   fade *= (0.02 / clamp(vec(d->vel).add(d->falling).magnitude()/movespeed, 0.f, 1.f));
         fade *= (1 / clamp(vec(d->vel).add(d->falling).magnitude(), 0.f, 1.f));
      }
      else if (GAME(radarmode) != 1) //1 = always shown
      {
                   fade *= clamp(vec(d->vel).add(d->falling).magnitude()/movespeed, 0.f, 1.f); //normal
         fade *= clamp(vec(d->vel).add(d->falling).magnitude(), 0.f, 1.f);
      }
      if (GAME(radarhealthfade) != 0)
      {
         fade *= (6.7 / (GAME(radarhealthfade) * (GAME(spawnhealth) - d->health))); // fade damaged players (Fallen's idea, works w/ other 3)
      }


then in "vars.h", add this anywhere:

{l Code}: {l Select All Code}
GVAR(0, radarmode, 0, 0, 3); //when do players show up on radar? 0 = normal, 1 = always, 2 = Riidom's inversion, 3 = shooting, 4 = Fallen's health-based idea
GFVAR(0, radarhealthfade, 0, 0, FVAR_MAX); //how much damaged players fade on radar


Use this mod by changing the server-side variables "radarmode" (0-3) and "radarhealthfade" (any positive decimal, but I made 1 fit it best. 0 means off, or default.)

Feedback is welcome!
Attachments
ubuntubin.zip
Ubuntu Binaries- not necessarily guaranteed to work on your machine, but then compiling's easy on Ubuntu. (see forum for details.). It's a good idea to back up your old "bin" folder. Also includes several of my other mods.
(1.91 MiB) Downloaded 304 times
winbin.zip
Windows binaries, same as Ubuntu but for Windows.
(1.94 MiB) Downloaded 348 times
RadarModes.zip
The source code, for people who can compile
(30.86 KiB) Downloaded 310 times

Friendship is Magic Voice Chat Mod
(Map) Trespass
(Map) Suspended
Find out more about >DOOM< here: www.redoomclan.tk
User avatar
greaserpirate
 
Posts: 350
Joined: 22 Jun 2011, 18:23

Who is online

Users browsing this forum: No registered users and 1 guest