[Fixed] HUD models always reference ReadyWeapon

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

HUD models always reference ReadyWeapon

Postby Marisa Kirisame » Wed Dec 23, 2020 12:21 pm

This is a bit of a personal gripe due to some hackery I do with psprites belonging to different callers. I am readily aware that what I'm asking for may open up a whole can of worms with how things are currently set up.

psprites that are set to use states from callers that are not the player's current weapon will still use the same model as that weapon. This is because functions like RenderHUDModel will always fetch model frames for the ReadyWeapon's class, rather than the caller's (which in 99.9% of cases is the ReadyWeapon anyway).

I've personally done some changes to RenderHUDModel, PreparePlayerSprites and IsHUDModelForPlayerAvailable that should fix this and I'm currently testing if anything breaks. If this turns out to be acceptable I'll open a PR for it. The main change is merely swapping player->ReadyWeapon->GetClass() with psp->Caller->GetClass() in calls to FindModelFrame. It works as I'd expect, but I can't guarantee nothing will break, hence all the testing.

Edit: Now, I know well that this could be simply worked around by adding those sprites to the MODELDEF of the weapon... but they would have to be added to ALL weapons to account for all potential combinations, which is honestly counter-intuitive.

PS: I've also changed IsHUDModelForPlayerAvailable so it checks for PSP_STRIFEHANDS too, mainly so those can be modelled too.
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: HUD models always reference ReadyWeapon

Postby Cherno » Wed Dec 23, 2020 1:49 pm

I support this! When I write my Onslaught! TC I ran into this issue when I wanted to have differnent shields as overlays along with any melee weapon. I had to put all the shield MODELDEFS inside the entries of all the weapons which seemed really odd and also a nightmare if something has to be changed (because it would have to be changed for all weapon entries even though it's always the same shield).
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: HUD models always reference ReadyWeapon

Postby Marisa Kirisame » Thu Dec 24, 2020 10:02 am

I'd say this seems to be working fine, so once I've crafted an example wad I'll send in the pull request.
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: HUD models always reference ReadyWeapon

Postby Graf Zahl » Wed Aug 11, 2021 12:09 pm

PR got merged.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: HUD models always reference ReadyWeapon

Postby Nash » Wed Aug 11, 2021 10:26 pm

So if I understand correctly, what this allows is for the model to be fetched individually from CustomInventories, whereas previously, it would only fetch models from the ReadyWeapon, forcing you to define all possible model frames on the ReadyWeapon?
User avatar
Nash
Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: HUD models always reference ReadyWeapon

Postby Graf Zahl » Wed Aug 11, 2021 11:58 pm

The code assumed that only the ReadyWeapon can display HUD sprites. Remember, this was from before the HUD code was extended, this part was just overlooked when those new features were added.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 4 guests