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.
Post Reply
CP95
Posts: 3
Joined: Thu May 21, 2020 6:44 pm

Mugshot on the minimal HUD (DOOM)

Post by CP95 »

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.
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: Mugshot on the minimal HUD (DOOM)

Post by 3saster »

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 all

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 all

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 all

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 167 times
CP95
Posts: 3
Joined: Thu May 21, 2020 6:44 pm

Re: Mugshot on the minimal HUD (DOOM)

Post by CP95 »

Thank you for taking the time to help me. It works great! :)
User avatar
arnaldocsf
Posts: 4
Joined: Thu Apr 30, 2020 7:54 am
Graphics Processor: Intel (Modern GZDoom)

Re: Mugshot on the minimal HUD (DOOM)

Post by arnaldocsf »

Strangely the pk3 don't work for me...
I tried to use the same code in my WAD too and nothing.
User avatar
Hyozen
Posts: 1
Joined: Tue May 19, 2020 10:53 pm

Re: Mugshot on the minimal HUD (DOOM)

Post by Hyozen »

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.
Post Reply

Return to “Assets (and other stuff)”