Change Player Mugshot for diffent level?
Moderator: GZDoom 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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 524
- Joined: Tue Jun 17, 2014 11:22 pm
- Graphics Processor: nVidia (Legacy GZDoom)
Change Player Mugshot for diffent level?
So I would like to know if it is possible to change the players face sprites after a certain level. I have two sets of face sprites I created for my character wearing a mask and when the level is completed I would like it to switch to the sprites where he is no longer wearing the mask. How would I do this?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 35
- Joined: Fri Jul 17, 2020 5:38 am
- Operating System Version (Optional): Windows 7
- Graphics Processor: nVidia with Vulkan support
Re: Change Player Mugshot for diffent level?
My response would be an entirely custom made mugshot system in ACS / Zscript! A total overkill to do just that, but it'd be possible... for the generic Doom HUD, as you'd need to position it yourself, so any custom HUDs would de-sync pretty easily.
-
- Posts: 1356
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: Change Player Mugshot for diffent level?
No need for a new system. But i think this could be easily done with zscript statusbar.
-
-
- Posts: 1552
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: Change Player Mugshot for diffent level?
The main problem here is that the player's Face property cannot be modified from user code, so a ZScript-based HUD is likely the only way to solve this at the moment. It is possible to leverage the existing GetMugshot method and work with the value is returns: if you need to alter the mugshot, you can use TexMan.GetName and TexMan.CheckForTexture to find a replacement for the original texture returned by GetMugshot and then draw it.
Suppose you have a collection of mugshot graphics that represent the masked player. For this to work, they must follow the same naming convention as the original ones, but with a different 3-letter prefix (e.g. STFST20 -> MTFST20).
Now, in your custom status bar class, you can implement the following method:
The biggest inconvenience here is that GetMugshot is not virtual, so you cannot just replace it and be done with it. It might warrant a feature suggestion, but the proper way to go is being able to modify the player's Face directly, which is not possible at the moment. That's what the suggestion should be about.
Right now, if you want to use the Doom status bar in its unchanged form in your mod, below you will find the complete ZScript code for that.
Suppose you have a collection of mugshot graphics that represent the masked player. For this to work, they must follow the same naming convention as the original ones, but with a different 3-letter prefix (e.g. STFST20 -> MTFST20).
Now, in your custom status bar class, you can implement the following method:
Code: Select all
private TextureID MyGetMugshot(int accuracy, int stateflags = MugShot.STANDARD, String default_face = "STF")
{
let result = GetMugshot(accuracy, stateflags, default_face);
if (result.IsValid() && IsPlayerMasked())
{
// Modify the name
string texName = TexMan.GetName(result);
texName = "MTF" .. texName.Mid(3);
// Find replacement graphic
result = TexMan.CheckForTexture(texName, TexMan.Type_MiscPatch);
}
return result;
}
private bool IsPlayerMasked()
{
// TODO: Return true if the player is currently masked.
}
Right now, if you want to use the Doom status bar in its unchanged form in your mod, below you will find the complete ZScript code for that.
Spoiler:You will also have to add the following to your MAPINFO so that the new status bar becomes active:
Code: Select all
gameinfo
{
StatusBarClass = "MyDoomStatusBar"
}