GetPointer

From ZDoom Wiki
Jump to navigation Jump to search

Actor

native clearscope Actor GetPointer(int aaptr)

Usage

Converts the calling actor's DECORATE-style AAPTR* pointer to a real ZScript Actor pointer.

Parameters

  • int aaptr
DECORATE-style AAPTR* pointer

Return values

  • Actor — a ZScript pointer to an Actor instance

Examples

The A_ScaleVelocity function, as defined in ZScript, uses this function:

	void A_ScaleVelocity(double scale, int ptr = AAPTR_DEFAULT)
	{

		let ref = GetPointer(ptr);

		if (ref == NULL)
		{
			return;
		}

		bool was_moving = ref.Vel != (0, 0, 0);

		ref.Vel *= scale;

		// If the actor was previously moving but now is not, and is a player,
		// update its player variables. (See A_Stop.)
		if (was_moving)
		{
			ref.CheckStopped();
		}
	}

See also