A_FreezeDeath

From ZDoom Wiki
(Redirected from A GenericFreezeDeath)
Jump to navigation Jump to search


Actor

void A_FreezeDeath()
void A_GenericFreezeDeath()

Usage

Performs frozen death effects. These functions are intended to be used in the first state of the actor's Ice state sequence.

A_FreezeDeath was designed for Hexen and performs a number of operations:

  • sets a bunch of flags to make the actor solid, shootable, non-bleeding etc.;
  • resets the actor's Height to its default value (since when dying actor's height is normally reset to 25% of their normal height or to their DeathHeight value);
  • calls the actor's special;
  • modifiers the actor's renderstyle;
  • randomly modifies the duration of the state where the function is called;

and a few other minor operations.

A_GenericFreezeDeath is a fallback solution that can be applied to all actors, even those that don't have a custom ice death sprite (in contrast to Hexen monsters, which do). In lieu of custom sprites, this function sets the calling actor's color translation to a special internal Ice palette, which has colors that may not be available in the current game's main palette.

Both of these functions are usually followed by A_FreezeDeathChunks which allow the monster to be broken into chunks by damage.

ZScript definition

A_FreezeDeath

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
	void A_FreezeDeath()
	{

		int t = random[freezedeath]();
		tics = 75+t+random[freezedeath]();
		bSolid = bShootable = bNoBlood = bIceCorpse = bPushable = bTelestomp = bCanPass = bSlidesOnWalls = bCrashed = true;
		Height = Default.Height;
		A_SetRenderStyle(1, STYLE_Normal);

		A_StartSound ("misc/freeze", CHAN_BODY);

		// [RH] Andy Baker's stealth monsters
		if (bStealth)
		{
			Alpha = 1;
			visdir = 0;
		}

		if (player)
		{
			player.damagecount = 0;
			player.poisoncount = 0;
			player.bonuscount = 0;
		}
		else if (bIsMonster && special)
		{ // Initiate monster death actions
			A_CallSpecial(special, args[0],	args[1], args[2], args[3], args[4]);
			special = 0;
		}
	}

A_GenericFreezeDeath

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
	void A_GenericFreezeDeath()
	{
		A_SetTranslation('Ice');
		A_FreezeDeath();
	}

Examples

This would create the same freezing properties from Hexen:

class FreezeDeathImp : DoomImp
{
  States
  {
  Ice:
    TROO V 5 A_FreezeDeath;
    TROO V 1 A_FreezeDeathChunks;
    wait;
  }
}