No announcement yet.

Modify scoreboard information

  • Filter
  • Time
  • Show
Clear All
new posts

  • Modify scoreboard information

    Hi all,

    First of all, I'd like to thank you for the amount of info related to QuakeC that can be found in these forums - it's been a great help so far.

    I'm doing some modifications to Quake using FTE and Darkplaces engine. Everything going smooth until now. I would like to modify the scoreboard info (add some string of text there) but I'm having trouble finding the correct place to do so.

    When checking config.cfg I see that "bind TAB "+showscores"", but looking for +showscores around any of the .qc files doesn't seem to bring any positive outcome.

    Does anybody know where's the piece of code I'm looking for?

    Thanks a lot!

  • #2
    Hi wizard,

    The scoreboard is drawn entirely through the engine code, meaning that you won't have access to it through server-side QC. The +showscores command is also read by the engine. Typically it's located in sbar.c if I'm not mistaken (in fitzquake derived engines, anyways).

    I'm almost positive you can do it through client-side QC (CSQC), especially because you have already stated your targeted engines are DP and FTE (the only 2 that I'm aware of that support CSQC). However, I can't help much beyond this because I haven't done a whole lot with CSQC so far.

    Good luck.
    'Replacement Player Models' Project


    • #3
      #pragma target "../csprogs.dat"
      #define CSQC
      #include "fteextensions.qc"
      float sb_showscores;
      float(string str) CSQC_ConsoleCommand =
      	local float args;
      	args = tokenize(str);
      	case "+showscores": sb_showscores = true; return TRUE;
      	case "-showscores": sb_showscores = true; return TRUE;
      	default: return FALSE;
      void(float apilevel, string enginename, float engineversion) =
      {	//for correctness
      void(float width, float height, float do2d) CSQC_UpdateView =
      	//quickie code to make sure the game's view is still drawn
      	setproperty(VF_MIN, [0, 0, 0]);
      	setproperty(VF_SIZE, [width, height, 0]);
      	setproperty(VF_DRAWENGINESBAR, FALSE);
      	//throw in your own hud, because quake's sucks.
      //	if (do2d)
      //		drawcustomsbar();
      	//try to draw a really quick crappy scoreboard
      	if (do2d && sb_showscores)
      		for (float f = 0; ; f++)
      			string name = getplayerkeyvalue(-1-f, "name");
      			float frags = stof(getplayerkeyvalue(-1-f, "frags"));
      			float ping = stof(getplayerkeyvalue(-1-f, "ping"));
      			vector rgb = stov(getplayerkeyvalue(-1-f, "topcolor_rgb"));
      			if (rgb == '0 0 0') rgb = '1 1 1'; //looks like its DP, don't make it unreadable.
      			string isme = (player_localentnum==stof(getplayerkeyvalue(-1-f, "viewentity")))?" ITS ME!":""; //hack, but should work in both engines.
      			drawstring([0, 64+f*8], snprintf("Name: %s Frags: %g Ping: %g %s", name, frags, ping, isme), [8,8], rgb,1,0);
      Shove that into your csprogs.src file and compile with fteqcc.
      I've not actually tested it, so either fix it yourself or complain about all my typos.

      topcolor_rgb / bottomcolor_rgb don't work in DP. You would need to use topcolor and figure out some sort of table, hence why I force it to white above.
      in DP, sb_showscores is directly set by the engine. you don't get any notification about when exactly the button is pressed. That's why I used a global with that name specifically.
      in FTE, you can use any userinfo key visible to the client. Use the 'users' / 'user' commands to peek at what's set. ssqc can use forceinfokey to explicitly set custom keys. DP does not support userinfos (beyond name, colour, frags).
      use drawfill/drawpic to mask out the backgrounds so you can actually read any of it.
      I didn't provide any hud code. Disabling the engine's sbar ensures that DP won't try drawing a scoreboard in addition to your code, while +showscores being handled by the csqc means that fte won't feel the need to draw it. You probably wanted a custom hud too, right?
      in DP, VF_MIN/VF_SIZE is probably still buggy. you can just comment them out if you can ensure that viewsize is 120 otherwise its anyone's guess how much of the screen is covered by quake's opaque hud and thus not drawn.

      have fun.
      Some Game Thing


      • #4

        I actually started reading Spike's CSQC guide for idiots yesterday and already realized CSQC is definitely the way to go.

        Thank you both for your knowledge and insight. I will hit the forums again if I have any issue