GetMugShot

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


BaseStatusBar

native TextureID GetMugshot (int accuracy, int stateflags = MugShot.STANDARD, String default_face = "STF");

Usage

Returns the TextureID of the current mugshot. The mugshot can then be drawn in a ZScript HUD using the DrawTexture (similarly to how the DrawMugShot function is used in SBARINFO).

Parameters

  • int accuracy
A number in the 1-9 range which specifies how many blood levels there are before death. Doom's HUD uses the value of 5.
  • int stateFlags
Allows passing flags defined in the Mugshot struct. Possible flags are:
  • MugShot.STANDARD - No special behavior (default).
  • MugShot.XDEATHFACE - Mugshot will enter its XDeath state when the player is gibbed.
  • MugShot.ANIMATEDGODMODE - Mugshot will enter the GodAnimated state instead of the standard God state when the player is invulnerable.
  • MugShot.DISABLEGRIN - Disables the Grin state
  • MugShot.DISABLEOUCH - Disables the Ouch state
  • MugShot.DISABLEPAIN - Disables the Pain state
  • MugShot.DISABLERAMPAGE - Disables the Rampage state
  • MugShot.CUSTOM - (Need more info)
Flags can be combined with |.
  • string default_face
Specifies the default prefix for the mugshot graphics to be used. This is only used if the Player.Face value in the PlayerPawn is undefined or invalid. The default value is "STF", which corresponds to the mugshot graphics used in Doom. If Player.Face is defined and the graphic exists, the value of this argument is ignored.

Examples

This bit is from Doom HUD's DrawMainBar function:

// If the inventory bar is active, draw the selected item
// instead of the mugshot:
if (CPlayer.mo.InvSel != null && !Level.NoInventoryBar)
{
	DrawInventoryIcon(CPlayer.mo.InvSel, (160, 198), DI_DIMDEPLETED);
	if (CPlayer.mo.InvSel.Amount > 1)
	{
		DrawString(mAmountFont, FormatNumber(CPlayer.mo.InvSel.Amount), (175, 198-mIndexFont.mFont.GetHeight()), DI_TEXT_ALIGN_RIGHT, Font.CR_GOLD);
	}
}
// Otherwise draw the mugshot at the center of the statusbar:
else
{
	DrawTexture(GetMugShot(5), (143, 168), DI_ITEM_OFFSETS);
}