Custom AltHud class

Moderator: GZDoom Developers

User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Custom AltHud class

Post by Nash »

I saw this remark in DBaseStatusBar::DBaseStatusBar:

Code: Select all

    // Create the AltHud object. Todo: Make class type configurable.
    FName classname = "AltHud";
    auto cls = PClass::FindClass(classname);
    if (cls)
    {
        AltHud = cls->CreateNew();
 
... so it appears that it was planned to allow a custom AltHud class for mods? I would very much like this, because I am currently working on a mod with a totally different kind of weapon system, which would make the Alt HUD unusable for players who prefer it.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom AltHud class

Post by Graf Zahl »

Yes, it was indeed intended to allow setting this through GAMEINFO, but got forgotten somehow. The class itself needs a bit of work before doing it, though.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom AltHud class

Post by _mental_ »

What kind of work? A base class for alternative HUDs? With exception of making Init virtual, and maybe Draw too, instead of DrawInGame and DrawAutomap, I could not imagine anything meaningful.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom AltHud class

Post by Graf Zahl »

I'd make all sub-drawers virtual, so that mods can, for example customize the ammo display which in general is what's needed the most.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Custom AltHud class

Post by Nash »

Agreed with Graf - when I made this thread, all I had in mind was to customize the ammo and weapon drawer... had no intention to touch anything else. So being able to select which of the several drawers to override/customize is preferable.
User avatar
Player701
 
 
Posts: 1636
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Custom AltHud class

Post by Player701 »

Graf Zahl wrote:for example customize the ammo display which in general is what's needed the most.
Hey, that's exactly what I could use right now. If it were possible to modify the alternative HUD, I could provide a lightweight replacement for the main HUD used in my project. It appears that the HUD system I've been developing recently may be just too much for older entry-level CPUs, but I can't use standard HUDs as fallback due to how the weapons are designed.

Also, just to clarify, do I understand it correctly that the OP's suggestion is not just that the AltHUD can be subclassed and modified, but also that it can be replaced so that enabling "Alternative HUD" in the options menu will enable the custom alternative HUD instead of the original one? That, of course, sounds reasonable, but I just wanted to be sure.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Custom AltHud class

Post by Blue Shadow »

Correct me if I'm wrong, but I thought the idea behind the alt HUD is that it acts as a fall-back in case someone does silly things like removing the status bar and fullscreen HUD.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom AltHud class

Post by Graf Zahl »

Correct, but the weapon problem needs a solution, I've seen too many mods where the weapon/ammo part is totally broken.
I'll have to see whether I actually allow overriding the drawers or merely the collection functions. Probably the latter.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Custom AltHud class

Post by Nash »

To be specific, here are the two features of my current mod that make the default Alt Hud look not too useful:

1 - I am implementing a weapon system similar to the game Borderlands - in that game, weapons are uniquely generated, so you may not necessarily "have" the same weapons in your inventory all the time. The weapon drawer ideally should be dynamic.
2 - I am implementing a custom armor system where this is no single armor value - the player can equip 3 different armor pieces (helmet, body armor, boots) and I would like to draw the armor amount of the difference pieces. Also the armor icon should be dynamic, because there would be different kinds of armor pieces to find and equip.

Of course, it's up to you to decide how much customizability you'll want to allow. :)
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom AltHud class

Post by _mental_ »

Here is what I made so far. It's up to Graf to leave/add/replace existing virtual functions, I didn't touch it intentionally except Init() method.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Custom AltHud class

Post by Nash »

mental: thanks for kickstarting this! Any kind of customizability would be appreciated at this point. :)
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom AltHud class

Post by _mental_ »

As this PR didn't receive any comments, I propose the following. I will merge it, make most of functions virtual, and add a CVAR that will force usage of internal AltHUD.
So, alternative HUD will be fully customizable, but it can be overridden with the default one if player wants to do it for some reason.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Custom AltHud class

Post by Nash »

Yes, that sounds like the most fair course of action to everyone concerned.
User avatar
Player701
 
 
Posts: 1636
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Custom AltHud class

Post by Player701 »

Agreed. I will just have to add a reminder for those who want to use the custom AltHUD to disable the override CVAR.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom AltHud class

Post by _mental_ »

I pushed the changes to PR branch. If there will be no concerns, I'll merge it to master.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”