Classes:SoundEnvironment

From ZDoom Wiki
Jump to navigation Jump to search
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
  1. You do NOT need to copy that actor, since it is already defined.
  2. In fact, it's not just useless, it will cause problems.
  3. If you want to modify it, or use a modified version, using inheritance is the way to go.
  4. The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
Sound environment
Actor type Map spot Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number 9048 Class Name SoundEnvironment


Classes: SoundEnvironment

A sound environment changes the reverberation qualities of an area in the map. This is not limited to a sector, boundaries must be drawn with Line_SetIdentification (in Hexen format) or the zoneboundary flag set to true (in UDMF). Only one reverb can be active in an area at a time.

The thing takes two arguments, which define which type of environment to use. See the REVERBS lump for a list of environments. For example, with a first argument of 30 and a second argument of 0, the "Castle Alcove" environment (30-0) is used.

A sound environment thing given the DORMANT flag in the map editor does not take effect until activated, but an active environment cannot be simply deactivated to disable the effect; instead another environment must be activated in the same area. The environment 0-0 can be used in this way to disable reverberation effects.

ZScript definition

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.
class SoundEnvironment : Actor
{
	default
	{
		+NOSECTOR
		+NOBLOCKMAP
		+NOGRAVITY
		+DONTSPLASH
		+NOTONAUTOMAP
	}
	
	override void PostBeginPlay ()
	{
		Super.PostBeginPlay ();
		if (!bDormant)
		{
			Activate (self);
		}
	}

	override void Activate (Actor activator)
	{
		CurSector.SetEnvironmentID((args[0]<<8) | (args[1]));
	}

	// Deactivate just exists so that you can flag the thing as dormant in an editor
	// and not have it take effect. This is so you can use multiple environments in
	// a single zone, with only one set not-dormant, so you know which one will take
	// effect at the start.
	override void Deactivate (Actor deactivator)
	{
		bDormant = true;
	}
	
}

DECORATE definition

Note: This is legacy code, kept for archival purposes only. DECORATE is deprecated in GZDoom and is completely superseded by ZScript. GZDoom internally uses the ZScript definition above.
ACTOR SoundEnvironment native
{
  +NOSECTOR
  +NOBLOCKMAP
  +NOGRAVITY
  +DONTSPLASH
}