[Added] Custom AltHud class

Moderator: GZDoom Developers

Custom AltHud class

Postby Nash » Tue Nov 19, 2019 9:33 am

I saw this remark in DBaseStatusBar::DBaseStatusBar:

Code: Select allExpand view

    
// 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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Custom AltHud class

Postby Graf Zahl » Tue Nov 19, 2019 10:01 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Custom AltHud class

Postby _mental_ » Tue Nov 19, 2019 10:45 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Custom AltHud class

Postby Graf Zahl » Tue Nov 19, 2019 11:20 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Custom AltHud class

Postby Nash » Tue Nov 19, 2019 12:28 pm

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Custom AltHud class

Postby Player701 » Tue Nov 19, 2019 2:43 pm

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.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russian Federation
Discord: Player701#8214
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Custom AltHud class

Postby Blue Shadow » Tue Nov 19, 2019 4:41 pm

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
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Custom AltHud class

Postby Graf Zahl » Tue Nov 19, 2019 5:21 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Custom AltHud class

Postby Nash » Tue Nov 19, 2019 8:53 pm

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. :)
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Custom AltHud class

Postby _mental_ » Wed Nov 20, 2019 11:36 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Custom AltHud class

Postby Nash » Sat Nov 23, 2019 7:48 pm

mental: thanks for kickstarting this! Any kind of customizability would be appreciated at this point. :)
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Custom AltHud class

Postby _mental_ » Tue Nov 26, 2019 3:58 am

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.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Custom AltHud class

Postby Nash » Tue Nov 26, 2019 4:12 am

Yes, that sounds like the most fair course of action to everyone concerned.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Custom AltHud class

Postby Player701 » Tue Nov 26, 2019 4:14 am

Agreed. I will just have to add a reminder for those who want to use the custom AltHUD to disable the override CVAR.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russian Federation
Discord: Player701#8214
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Custom AltHud class

Postby _mental_ » Tue Nov 26, 2019 5:08 am

I pushed the changes to PR branch. If there will be no concerns, I'll merge it to master.
_mental_
 
 
 
Joined: 07 Aug 2011

Next

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest