|
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
- This actor is already defined in GZDoom, there's no reason to define it again.
- In fact, trying to define an actor with the same name will cause an error (because it already exists).
- If you want to make your own version of this actor, use inheritance.
- Definitions for existing actors are put on the wiki for reference purpose only.
|
Torch power
|
Actor type
|
Power
|
Game
|
(ZDoom)
|
DoomEd Number
|
None
|
Class Name
|
PowerTorch
|
Classes: Inventory→Powerup→PowerLightAmp→PowerTorch
One of the many powerups, i.e. items based on the Powerup class. While an item of this class is placed in an actor's inventory, the actor will be affected by it. Usually powerups are given through a PowerupGiver, but they can be given directly as well (see here for more details).
PowerTorch is a subclass of PowerLightAmp, designed for the ArtiTorch in Heretic. It is mostly equivelant to PowerLightAmp, although the brightness flickers a bit for a more believable torch effect. The OpenGL renderer's option of "enhanced night vision mode" also colors the screen with this powerup with a faint yellow glow rather than the PowerLightAmp's full night-vision goggle.
|
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 PowerTorch : PowerLightAmp
{
int NewTorch, NewTorchDelta;
override void DoEffect ()
{
if (Owner == NULL || Owner.player == NULL)
{
return;
}
let player = Owner.player;
if (EffectTics <= BLINKTHRESHOLD || player.fixedcolormap >= PlayerInfo.NUMCOLORMAPS)
{
Super.DoEffect ();
}
else
{
Powerup.DoEffect ();
if (!(Level.maptime & 16) && Owner.player != NULL)
{
if (NewTorch != 0)
{
if (player.fixedlightlevel + NewTorchDelta > 7
|| player.fixedlightlevel + NewTorchDelta < 0
|| NewTorch == player.fixedlightlevel)
{
NewTorch = 0;
}
else
{
player.fixedlightlevel += NewTorchDelta;
}
}
else
{
NewTorch = random[torch](1, 8);
NewTorchDelta = (NewTorch == Owner.player.fixedlightlevel) ?
0 : ((NewTorch > player.fixedlightlevel) ? 1 : -1);
}
}
}
}
}
|
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 PowerTorch : PowerLightAmp native {}