Code: Select all
/*
* ZDoom Rain
* DECORATE LUMP
*
* - Zippy
*
* Bonus Snow example stuff is included at the very bottom
*/
//
// RainDrop is a rain drop. It falls, splashes, and disappears.
// It is spawned by the rain drop generator actors and is not meant
// to be used alone. Can be used as a base class for new types of
// rain drops, as exampled with a later entry
//
ACTOR RainDrop 24600
{
Radius 8
Height 1
Mass 5
RenderStyle ADD
Alpha 0.3
Scale 0.5
+NOBLOCKMAP
+NOTELEPORT
+INVULNERABLE
+DONTSPLASH // A rain drop doesn't make that large a splash... You can
// uncomment this if you want it to splash in water, or you can
// be fancier and define a new type of rain drop meant to fall
// into water (in other words, you change the Crash state.)
+CORPSE // Is considered a corpse so we get the Crash state
+NONSHOOTABLE
States
{
Spawn:
RAIN A -1 //It's a corpse, so it just spawns and falls
Stop
Crash: // Crash is entered when it hits the floor
RAIN BC 2
Stop
}
}
//
// RainBase is the base class to carry the common properties amoung rain dropper
// objects. A RainBase actor itself is not meant to be placed anywhere in
// a map. Its ONLY purpose is to be inherited from.
//
ACTOR RainBase 24601
{
Radius 16
Height 6
RenderStyle NONE
+NOGRAVITY
+NOBLOCKMAP
+NOLIFTDROP
+NOTELEPORT
+INVULNERABLE
+SPAWNCEILING
+NONSHOOTABLE
+NOCLIP
States // Do nothing...
{
Spawn:
TNT1 A 1
Stop
}
}
//
// A second rain drop type, this one has a spawn animation. It hangs from the
// ceiling and drips for a moment before falling. This is for leaks inside or
// overhangs outside in the rain.
//
ACTOR DripDrop : RainDrop 24602
{
RenderStyle ADD
Alpha 0.3
Scale 0.5
+NOGRAVITY // so they don't fall immediately
States
{
Spawn:
RAIN D 4
RAIN E 6
RAIN F 4
RAIN G 2
RAIN A 0 A_Gravity //Now it falls
RAIN A -1 // Corspe heading towards the floor
Stop
Crash: // Crash is entered when it hits the floor
RAIN BC 2
Stop
}
}
// Double sprited raindrops, which don't look QUTIE as good as using single
// ones, but can be used to reduce pressure on the engine while still making
// rain appear somewhat "thick"
ACTOR DoubleDrop : RainDrop 24607
{
States
{
Spawn:
RAIN H -1
Stop
Crash:
RAIN IJK 2
Stop
}
}
// A second Double rain drop which uses a different animation. Hopefully to
// provide some variety so it doesn't look as low quality
ACTOR DoubleDrop2 : DoubleDrop 24608
{
States
{
Spawn:
RAIN L -1
Stop
Crash:
RAIN MNO 2
Stop
}
}
//=======================
// Square Rain Droppers
//=======================
//
// These Actors will drop rain around them within the pattern of a square. So when you
// place one on your map, it is the center of the square.
//
// There are three kinds (feel free to make more): "Fast", "Med", and "Slow".
// A fast dropper will release a drop every tic, a medium every 2 tics, and a slow
// every 3 tics.
//
// You specify the size of the square via the thing's first argument in the map editor.
// The value you specify is taken as HALF the length of one side of the square. So if
// you specify 32, you actually get a 64 by 64 square. The purpose is two fold:
// 1) You can make larger squares since the value is doubled
// 2) When placing the thing in an editor with the grid one, setting the grid to be
// the same size as the value will give an accurate representation of the rain
// fall zone. If the grid is 32x32 squares, and you give the dropper the value
// 32, then when you place it on the map it covers the 4 squares around it.
// eg. 4 32x32 squares
// |---|---|
// | | |
// | | |
// |---O---| <- That O is your SquareRain dropper with args[0] = 32,
// | | | so it will cover a square 64x64 in size, or the
// | | | 4 squares immeadiately around it.
// |---|---|
//
// It's important to note that you don't need to set the Z height of your dropper. It
// will spawn on the ceiling on its own. What goes HAND IN HAND with this is also
// important. Rain drops are spawned AT THE HEIGHT OF THE DROPPER, WITHOUT REGARD FOR
// THE SECTOR HEIGHT. Esstially, if you put a SquareRainFast (args[0] = 32) dropper in
// a sector with ceiling height 128, and with the 64x64 square is another sector whose
// ceiling is higher (256 for example), then the rain drops which get spawned in that sector
// will STILL SPAWN AT THE HEIGHT OF 128!!! This isn't that big of a problem considering
// in the real world it tends to only rain outside, and most of your contiguous sectors
// with sky will be of the same height. The plus side to this effect is that sectors
// nearby whose ceilings are LOWER that the one containing the dropper WON'T GET
// RAIN DROPS, DESPITE BEING IN RANGE OF THE DROPPER. This means it can be pretty
// easy to fit your droppers around the edges of certain structures outside (like
// a pavilion etc.)
//
// A final important note is to realize the role area plays in all this. A Fast
// dropper releases a drop every tic, but a Fast dropper with a smaller args[0] will
// appear to be "raining harder" than a Fast dropper with a larger args[0]. This is
// because the LARGER in space means the 30 drops in 30 tics are spread out over a
// bigger area, and don't look as condense as the same 30 drops packed into a smaller
// area. Remember that when you are trying to cover everywhere of an oddly shaped outside
// zone. All you droppers don't need to be the same speed because a Fast dropper will
// appear to create rain at about the same "thickness" as a Med or even Slow dropper who
// have smaller area.
//
ACTOR SquareRainFast : RainBase 24611
{
States
{
Spawn:
TNT1 A 1 ACS_ExecuteAlways(650,0,args[0])
Loop
}
}
ACTOR SquareRainMed : RainBase 24612
{
States
{
Spawn:
TNT1 A 2 ACS_ExecuteAlways(650,0,args[0])
Loop
}
}
ACTOR SquareRainSlow : RainBase 24613
{
States
{
Spawn:
TNT1 A 3 ACS_ExecuteAlways(650,0,args[32])
Loop
}
}
//=======================
// Circle Rain Droppers
//=======================
//
// These Actors will drop rain around them within the pattern of a circle. So when you
// place one on your map, it is the center of the circle.
//
// Again, they are "Fast", "Med", and "Slow".
//
// This time, the first argument you give it is treated as the radius of the circle, so
// the largest you can go is 255. If you need larger, make your own extension that
// doubles the given value, or uses a highbyte, or something like that.
//
// The issue concerning sector ceiling heights still applies.
//
ACTOR CircleRainFast : RainBase 24621
{
States
{
Spawn:
TNT1 A 1 ACS_ExecuteAlways(651,0,args[0])
Loop
}
}
ACTOR CircleRainMed : RainBase 24622
{
States
{
Spawn:
TNT1 A 2 ACS_ExecuteAlways(651,0,args[0])
Loop
}
}
ACTOR CircleRainSlow : RainBase 24623
{
States
{
Spawn:
TNT1 A 3 ACS_ExecuteAlways(651,0,args[0])
Loop
}
}
//=======================
// Line Rain Droppers
//=======================
//
// These Actors will drop rain along a defined line. This doesn't make much sense for
// outside sky use, but is useful for overhangs (areas you would expect water to pile
// up on and slowly drip down from.)
//
// Again, speeds are "Fast", "Med", and "Slow", though the drops per tic are reduced for
// each. Rain doesn't drop down from the ceiling that fast.
//
// The value you give for args[0] is HALF the length of the line, for the same reason
// as it was for the square droppers: make larger lines and easier grid layout.
//
// The issue concerning sector ceiling heights still apply.
//
// To set the direction of the line, place the thing on your map and set it's angle.
// If the angle is 0, then the line is horizontal. If the angle is 90, the line is
// vertical. Whatever angle you set it to is the direction the line goes.
//
// Here I am going to make use of the DripDrop actor I defined above. In my example
// map I only used LineRain as overhang drops. Normally this looks very ugly with
// the regular rain (it looks more like it's just raining intside the overhang. This
// will make it look more like it drips from collecting on the overhang.
//
ACTOR LineRainFast : RainBase 24631
{
States
{
Spawn:
TNT1 A 4 ACS_ExecuteAlways(652,0,args[0])
Loop
}
}
ACTOR LineRainMed : RainBase 24632
{
States
{
Spawn:
TNT1 A 7 ACS_ExecuteAlways(652,0,args[0])
Loop
}
}
ACTOR LineRainSlow : RainBase 24633
{
States
{
Spawn:
TNT1 A 10 ACS_ExecuteAlways(652,0,args[0])
Loop
}
}
//=========================
// Rectangle Rain Droppers
//=========================
//
// These Actors will drop rain in a rectangle, with the actor itself at the
// center.
//
// Again, the kinds are "Fast", "Med", and "Slow"
//
// This time the actors take two special arguments. The first one is half the
// length of the rectangle's LENGTH (horizontal size). The second is half the
// length of the rectangle's HEIGHT (vertical size). This lets you place rain
// droppers to fill in areas a bit better.
//
// The issue concerning sector ceiling heights still applies.
//
ACTOR RectangleRainFast : RainBase 24641
{
States
{
Spawn:
TNT1 A 1 ACS_ExecuteAlways(653,0,args[0],args[1])
Loop
}
}
ACTOR RectangleRainMed : RainBase 24642
{
States
{
Spawn:
TNT1 A 2 ACS_ExecuteAlways(653,0,args[0],args[1])
Loop
}
}
ACTOR RectangleRainSlow : RainBase 24643
{
States
{
Spawn:
TNT1 A 3 ACS_ExecuteAlways(653,0,args[0],args[1])
Loop
}
}
// DoubleDrop square rain dropper, to be used in an example map. You can
// extend this list yourself if you need it
ACTOR SquareDoubleRainSlow : RainBase 24661
{
States
{
Spawn:
TNT1 A 3 ACS_ExecuteAlways(654,0,args[0])
Loop
}
}
// Mutliple mode dropper. This type of dropper is an example of one that
// can be changed between different modes. The example here is "full",
// which is the same as a fast dropper, "half", which is the same as
// a medium double dropper (thus being half as stressful on the engine,
// while producing rain of slightly less quality), and "off", which is
// obviously no rain at all
//
// The frame delay is 2, which is the slowest of the modes (HALF). The
// mode itself is stored in the script library. Script #655 spawns drops
// based on the mode. If it is FULL mode, it spawns a drop and then delays
// for a tic and spawns another, giving it that full speed effect.
ACTOR SquareMultiFast : RainBase 24671
{
States
{
Spawn:
TNT1 A 2 ACS_ExecuteAlways(655,0,args[0])
Loop
}
}
//
// SNOW
//
// Here's an example of making snow, following the same principle the rain
// droppers are based on. Since it's part example, there are no speed choices.
//
// A snow flake. Inherited from raindrop to get some of the same properties
ACTOR SnowFlake : RainDrop 24603
{
Alpha 0.8
Scale 0.3
+NOGRAVITY // No gravity so we can control its fall speed with ThrustThingZ
States
{
Spawn:
SNOW A 0
SNOW A 1 ThrustThingZ(0,2,1,0) // Arg 2 is the downward speed, I
SNOW A 8 A_Jump(92,2) // find 2 gives nice gentle snow
SNOW A 8 A_CStaffMissileSlither
SNOW A 8 // Slither makes it shake a little rather than
Goto Spawn+2 // fall down straight vertically
Crash:
SNOW A 16
Stop
}
}
// This alternate snow flake is just another test at making some snow. It
// turned out a bit more random than the previous kind of flake, with snow
// going everywhere (and quickly blowing out of the defined size region), but
// it does give a reasonably nice effect.
ACTOR SnowFlake2 : SnowFlake 24604
{
States
{
Spawn:
SNOW A 0
SNOW A 1 ThrustThingZ(0,2,1,0) // Again, 2 for a nice slow drop
SNOW A 16 A_Jump(92,4)
SNOW A 16 ThrustThing(random(0,64),1,0,0)
SNOW A 32 // ^ v these thrusts just blow it randomly about
SNOW A 16 ThrustThing(random(128,192),1,0,0)
SNOW A 16 A_Jump(92,4)
SNOW A 16 ThrustThing(random(64,128),1,0,0)
SNOW A 32
SNOW A 16 ThrustThing(random(192,255),1,0,0)
SNOW A 16
Goto Spawn+2
Crash:
SNOW A 16
Stop
}
}
// This alternate snow flake is yet another test at a different looking kind
// of snow. It isn't quite as insane as #2, but still conveys some random
// motion. Also, it's projectile so that it disappears when it hits walls
// (otherwise it piles up on walls and looks weird.) This means you can run
// into it to make it disappear as well.
ACTOR SnowFlake3 : SnowFlake 24605
{
PROJECTILE
States
{
Spawn:
SNOW A 0
SNOW A 1 ThrustThingZ(0,2,1,0) // 2 for slow falling snow
SNOW A -1 ThrustThing(random(0,255),1,0,0)
Stop
Crash:
SNOW A 16
Stop
}
}
// This alternate snow flake is another test at a differnt looking kind of
// snow. All the flakes spawned from one dropper will fall down at the same
// angle, so it is kind of a windy snow effect. This is acheived by having
// the dropper spawn them all facing the same angle. Then, the flakes always
// thrust themselves FORWARD when they spawn ( (angle*256)/360 is converting
// the 360 degree angle to a byte angle)
ACTOR SnowFlake4 : SnowFlake3 24606
{
States
{
Spawn:
SNOW A 0
SNOW A 1 ThrustThingZ(0,2,1,0) // Graceful like a GAZELLE
SNOW A -1 ThrustThing((angle*256)/360,1,0,0)
Stop
Crash:
SNOW A 16
Stop
}
}
// Square snow dropper. args[0] is the half the side length of a square.
// This one uses the first gentle kind of snow flake.
ACTOR SquareSnow : RainBase 24651
{
States
{
Spawn:
TNT1 A 6 ACS_ExecuteAlways(675,0,args[0])
Loop
}
}
// Same as the above but wields the more erratic snowflake #2.
ACTOR SquareSnowCrazy : RainBase 24652
{
States
{
Spawn:
TNT1 A 6 ACS_ExecuteAlways(676,0,args[0])
Loop
}
}
// Same as above but wields the less erratic (but still moreso than #1)
// snowflake #3
ACTOR SquareSnowAngled : RainBase 24653
{
States
{
Spawn:
TNT1 A 6 ACS_ExecuteAlways(677,0,args[0])
Loop
}
}
// Similar to #3, but instead gives ALL the snowflakes the same uniform
// direction. You set the direction by setting the angle of the dropper.
// This gives a wind like effect to the falling snow.
ACTOR SquareSnowDirectional : RainBase 24654
{
States
{
Spawn:
TNT1 A 6 ACS_ExecuteAlways(678,0,args[0])
Loop
}
}