Mugshot on the minimal HUD (DOOM)

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Mugshot on the minimal HUD (DOOM)

Postby CP95 » Thu May 21, 2020 7:03 pm

Hi there.

I'm looking for a way to enable the mugshot for the (default) minimal HUD without changing anything else.

Iwantmesomemugshot.jpg

I know is something simple, but I am no programmer, therefore I lack the knowledge to do so. I know it's related to the SBARINFO file though. So, if someone could spare me a few lines of code and tell me how to do it, I'd appreciate it.

*I'm using GZDoom by the way.
CP95
 
Joined: 22 May 2020

Re: Mugshot on the minimal HUD (DOOM)

Postby 3saster » Thu May 21, 2020 9:26 pm

CP95 wrote:I know it's related to the SBARINFO file though

Not quite. GZDoom has the old SBARINFO files for compatibility reasons (so I'm told that's the reason), but it actually uses ZScript nowadays for the HUD. In this case, the magic on the fullscreen HUD happens on the aptly named DrawFullScreenStuff function. All that really need to do to draw the mugshot is add the line
Code: Select allExpand view
DrawTexture(GetMugShot(5), (x, y), DI_ITEM_OFFSETS);

somewhere in that function (with x,y, being replaced with the actual coordinates you want it to be on screen, you'll have to experiment with those values). I'll put a bit of technical explanation below, to understand what exactly that line does.

To explain this, DrawTexture is just a function to, well, draw a texture, that takes a few inputs. The first input, GetMugShot(5), is the texture to draw; GetMugShot is a function that gives you what the texture that represent the current mugshot is (5 is how many "bleeding" levels it has). (x,y) is where exactly to draw it on the screen, relative to the "center" (by default, this is the top left corner iirc). DI_ITEM_OFFSETS is a flag that says respect any image offsets on the texture.

As for actually including this, there are a couple ways to do so. One is to directly edit the file in GZDoom.pk3 (strongly recommended to NOT do this, the changes will be lost when you update GZDoom, among other problems), the other is to make yourself a mod that implements this. To do this, first include a MAPINFO file with the following information
Code: Select allExpand view
gameinfo
{
    StatusbarClass = "MyCustomStatusbar"
}

This tells GZDoom what statusbar to use. Next, we include a ZSCRIPT lump that contains the details of that statusbar class. Normally, you might need make a class inhereting from DoomStatusBar, copy-paste the contents of the original ZScript Doom status bar, and make your changes. However, since all you want to do is add a feature, we can go one step further, and use inheretence. We'll add it to DrawFullscreenKeys, which draws the fullscreen keys normally (we are overriding this function since DrawFullscreenStuff cannot be overridden). We'll draw our face, then let GZDoom do whatever it normally does. The full thing should look something like this:
Code: Select allExpand view
Version "4.3.3"
// The version of ZScript to use (usually the latest version at the time of writing this mod is fine)

class MyCustomStatusbar : DoomStatusBar
{
   // We're gonna replace GZDoom's Fullscreen Key Drawing with our own
   override void DrawFullscreenKeys ()
   {
      // Draw our custom texture
      DrawTexture(GetMugShot(5), (90, 168), DI_ITEM_OFFSETS);
      // Draw everything else the Doom Statusbar would normally do
      Super.DrawFullscreenKeys();
   }
}

This has to advantage of if the fullscreen statusbar for doom gets updated (the Hexen one was a little while back), this HUD will respect those changes too, since it just lets GZDoom do most of the work normally. I've included a PK3 with this stuff, if you want to use that to learn/use.
Attachments
MyStatusBar.pk3
The fullscreen HUD with the mugshot on it. You can add this to your autoload if you always want to use it.
(648 Bytes) Downloaded 5 times
User avatar
3saster
 
Joined: 11 May 2018
Location: Canada

Re: Mugshot on the minimal HUD (DOOM)

Postby CP95 » Thu May 21, 2020 10:42 pm

Thank you for taking the time to help me. It works great! :)
CP95
 
Joined: 22 May 2020

Re: Mugshot on the minimal HUD (DOOM)

Postby arnaldocsf » Fri May 22, 2020 9:04 am

Strangely the pk3 don't work for me...
I tried to use the same code in my WAD too and nothing.
User avatar
arnaldocsf
 
Joined: 30 Apr 2020
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel (Modern GZDoom)

Re: Mugshot on the minimal HUD (DOOM)

Postby Hyozen » Fri May 22, 2020 4:23 pm

I love this. It not only shows you the mugshot, but it also shows you when you have a berserk powerup active, which is very nice.
User avatar
Hyozen
 
Joined: 20 May 2020


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 3 guests