HUD models always reference ReadyWeapon

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

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: magusmarisa
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: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests