Author Topic: Custom huds?  (Read 2565 times)

Offline Gibaholic

  • Newbie
  • *
  • Posts: 21
    • View Profile
  • Rated:
Custom huds?
« on: March 13, 2010, 08:41:24 PM »
Is there anyway i can customize the layout of my hud? I'd like to do something like this http://qlhud.core.ws/files/imgs/wicher_eER88a.jpg
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1371
    • View Profile
  • Rated:
Re: Custom huds?
« Reply #1 on: March 13, 2010, 10:39:57 PM »
Short answer, no. It would take a modified client.

But...

HUD layout is controlled by the server, actually the mod code, but it might be possible to change the way the client displays them. This occurs in the way the client interprets left/right/center, bottom/top, big/small text and the icons that represent the HUD elements. This is how custom hud paks can change the icons. The protocol is not precisely documented, at least not by idSoftware. The HUD is programed as a text string containing position and location information and indexes to the icons the client is to use. The client code would have to be modified to take the unmodified HUD string and interpret it in a different way and display the new text and icons in the correct positions for the new layout.

I documented it for myself when modifying the Q2 LOX code. Here is what I wrote, along with the HUD initialization function used in LOX. I patterned this function after finding something similar in the CTC mod and admiring how clean it was compared to the hard coded stuff in the original idSoftware game code. This function would only be of interest by mod coders but here it is. :

Code: [Select]
// ===================================================================
// Unified HUD initialization
// ===================================================================

// cursor positioning
// xl <value> x-left side
// xr <value> x-right side
// yb <value> y-bottom
// yt <value> y-top
// xv <value> x-virtual(?)
// yv <value> y-virtual(?)

// drawing
// statpic <name>
// pic <stat>
// num <fieldwidth> <stat>
// string <stat>

// control
// if <stat>
// ifeq <stat> <value>
// ifbit <stat> <value>
// endif

// //QW//
// In all cases <stat> is the integer representing the stat(us) message item
// to be presented. I've used manifest constants to keep the messages
// properly enumerated across the game modes and they are defined in
// q_shared.h. The ZOID code originally had these scattered about in
// different places but he mostly used magic numbers in the messages and that just
// made it hard to figure out exactly what was happening. He defined the constants
// and then didn't use them. (Duh!) Later authors were overlapping them in their
// mods or pulling in overlapping stat items from other mods and this created
// HUD conflicts. ENUM or #DEFINE, then USE the damn things. Please.

// Positioning:
// It looks like 0,0 is the center of the screen with x going negative to the right.
// xv, yv is relative to this origin at center.
// xl is plus counts from origin left justified.
// xr is minus counts from origin right justified.
// yb is minus counts from bottom.
// yt is plus counts from 0 at top.

/* //QW//
A standard HUD character (conchar) is 8 screen units wide. The xl and xr origins are with
respect to the left and right borders. Add/subract 2 units to keep a little space between
the edge and the chars. For example, the string "FPH" is 3 chars wide, 3 * 8 = 24 units.
If using xr, add 2 and negate, giving -26 from the right edge as the start of the
string on the screen, "Range" is (-1)(5 * 8 + 2) = -42.
Using xl, just use an origin of 2 to space a string 2 units from the border so it looks nice.
*/

// //QW//
// The big HUD characters for the counters are 16 units wide but
// their origin is already offset by 2.
// They are positioned at 0 on the left and at (n * 16)-2 on the right
// when n is the number of digits you want to display.
//
// Printing big chars on the left is problematic, they are right-justfied inside their
// block so printing them on the left will gap them from the edge when the value doesn't
// fill the full range of digits. Negative signs will probably be clipped if you don't
// allow an extra space for them.
// You should layout for signed values on the right side or midline where negative
// values aren't a problem.
// Layout for unsigned on the left if you don't mind having right-justfied
// blocks there. Allow space only for the number of digits you expect to
// display to keep the HUD packet as small as possible.

// I think I first saw an integrated HUD as a function in the CTC mod.
// I took it a little further by integrating the game modes and collecting
// the stat constants in one place. 

/* //QW//
Big HUD chars are 24 units tall and conchars are 8 for a total of 32 plus
vertical spacing of 3 units to make it 35 units for a per-line increment
on the big chars. I use a 25 unit vertical offset for the conchars label
below it. This seems to give a nice uniform leading between lines.
*/

// ===================================================================

void CreateStatusBar()
{
char Bar[256];
size_t s;

memset(statusbar, 0, sizeof(statusbar));

sprintf(Bar, "if %d yb -24 xv 0 hnum xv 50 pic %d ", STAT_HEALTH_ICON, STAT_HEALTH_ICON);
strcat(statusbar, Bar);

sprintf(Bar, "if %d xv 100 anum xv 150 pic %d endif ", STAT_AMMO_ICON, STAT_AMMO_ICON);
strcat(statusbar, Bar);

sprintf(Bar, "if %d xv 200 rnum xv 250 pic %d endif ", STAT_ARMOR_ICON, STAT_ARMOR_ICON);
strcat(statusbar, Bar);

sprintf(Bar, "if %d xv 296 pic %d endif ", STAT_SELECTED_ICON, STAT_SELECTED_ICON);
strcat(statusbar, Bar);

sprintf(Bar, "yb -50 if %d xv 0 pic %d xv 26 yb -42 stat_string %d yb -50 endif ",
STAT_PICKUP_ICON, STAT_PICKUP_ICON, STAT_PICKUP_STRING);
strcat(statusbar, Bar);

// ctf bar had xv at 262, test this //QW//
sprintf(Bar, "if %d xv 246 num 2 %d xv 296 pic %d endif ",
STAT_TIMER_ICON, STAT_TIMER, STAT_TIMER_ICON);
strcat(statusbar, Bar);

sprintf(Bar, "if %d xv 148 pic %d endif ", STAT_HELPICON, STAT_HELPICON);
strcat(statusbar, Bar);

sprintf(Bar, "xr -50 yt 2 num 3 %d ",STAT_FRAGS); //player frag count
strcat(statusbar, Bar);

if (ctf->value)
{
//red team pad captures
sprintf(Bar, "yb -102 if %d xr -26 pic %d endif xr -62 num 2 %d ",
STAT_CTF_TEAM1_PIC, STAT_CTF_TEAM1_PIC, STAT_CTF_TEAM1_CAPS);
strcat(statusbar, Bar);

//red joined overlay
sprintf(Bar, "if %d yb -104 xr -28 pic %d endif ",
STAT_CTF_JOINED_TEAM1_PIC, STAT_CTF_JOINED_TEAM1_PIC); //player frag count
strcat(statusbar, Bar);

//blue team pad captures
sprintf(Bar, "yb -75 if %d xr -26 pic %d endif xr -62 num 2 %d ",
STAT_CTF_TEAM2_PIC, STAT_CTF_TEAM2_PIC, STAT_CTF_TEAM2_CAPS);
strcat(statusbar, Bar);

//blue joined overlay
sprintf(Bar, "if %d yb -77 xr -28 pic %d endif ",
STAT_CTF_JOINED_TEAM2_PIC, STAT_CTF_JOINED_TEAM2_PIC); //player frag count
strcat(statusbar, Bar);

//uncaptured spawnpoints
sprintf(Bar, "if %d yb -50 xr -62 num 2 %d endif ",
STAT_CTF_NOTCAPPED, STAT_CTF_NOTCAPPED);
strcat(statusbar, Bar);
}

// player ID
sprintf(Bar, "if %d xv 30 yv 220 stat_string %d endif ", STAT_PLAYER, STAT_PLAYER);
strcat(statusbar, Bar);

// player frag per hour
sprintf(Bar, "if %d xr -66 yt 30 num 4 %d xr -26 yt 55 string FPH endif ",STAT_FPH, STAT_FPH);
strcat(statusbar, Bar);

// looks like a score digit is 16 screen units wide.
// rangefinder (-66)(-42)
sprintf(Bar, "if %d xr -66 yt 65 num 4 %d xr -42 yt 90 string Range endif ", STAT_RANGEFINDER, STAT_RANGEFINDER);
strcat(statusbar, Bar);

// player Height (-66)(-50) lines are spaced 35 units.
sprintf(Bar, "if %d xr -66 yt 100 num 4 %d xr -50 yt 125 string Height endif ", STAT_HEIGHT, STAT_HEIGHT);
strcat(statusbar, Bar);

// player number of TRACKERS deployed
sprintf(Bar, "if %d xr -34 yt 135 num 2 %d xr -66 yt 160 string Trackers endif ", STAT_NUMTRACKER, STAT_NUMTRACKER);
strcat(statusbar, Bar);

// player number of TURRETS deployed
sprintf(Bar, "if %d xr -34 yt 170 num 2 %d xr -58 yt 195 string Turrets endif ", STAT_NUMTURRET, STAT_NUMTURRET);
strcat(statusbar, Bar);

// player location
sprintf(Bar, "if %d xv 105 yv 140 stat_string %d endif ", STAT_LOCATION, STAT_LOCATION);
strcat(statusbar, Bar);

// Make sure we dont blow anything out of the water
s = strlen(statusbar);
if ( s > 1024)
{
gi.dprintf("HOLY COW: Statusbar too big %d\n", strlen(statusbar)); //to the log
statusbar[1023] = 0;
}
}

// end HUD initialization

// ===================================================================
« Last Edit: March 13, 2010, 10:44:43 PM by QwazyWabbit »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline X'tyfe

  • Phenomenally Prodigious Member
  • **
  • Posts: 3587
  • Yep
    • View Profile
  • Rated:
Re: Custom huds?
« Reply #2 on: March 14, 2010, 06:41:47 PM »
I would like to see this myself, surely there should be a way to override such things in the client? EzQuake has an awesome system for it, It's a modification of Quakeworld that includes such functions. As you can see by my pic, I created this layout here for myself.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline Randy

  • Swanky Member
  • *****
  • Posts: 636
    • View Profile
  • Rated:
Re: Custom huds?
« Reply #3 on: March 16, 2010, 05:38:44 PM »
LASER HAX :P
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline X'tyfe

  • Phenomenally Prodigious Member
  • **
  • Posts: 3587
  • Yep
    • View Profile
  • Rated:
Re: Custom huds?
« Reply #4 on: March 20, 2010, 09:39:26 AM »
Its not a laser!! Its part of the hud I swear
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.
 

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM
 

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.
 

Costigan_Q2

October 09, 2024, 01:35:05 PM
Et tu rikwad?

Please don't feed the degenerate lies of a sexually-perverted devil-worshipping barking dog like Focalor.

Show 50 latest
Welcome, Guest. Please login or register.
November 10, 2024, 04:40:28 AM

Login with username, password and session length