/*

  Better Falling Snow by Joe Wilcox
  (c) 1997, Simply Silly Software

  You need to add 3 sprites to your ART tiles and reference them below.
  I've included our default sprites.. feel free to use them.

  The 2 Snow Makers use their palettes to determine how often to spawn
  snow.  It goes as follows:

   Pal 0  : Lite Snow Storm
   Pal 1  : Medium Snow Storm
   Pal 2  : Very Lite Snow Storm
   Pal 3  : Flurries
   Pal 4  : Blizard


   The snowflake can be added by itself to give the appearance of it
   already snowing.  SNOWMAKER will roam around the screen dropping a
   flake every now and this.  This looks really good.  SNOWMAKERNOMOVE
   stands in once place.  You want to use this for holes in ceilings and
   other small areas.

   There are some limitations:

   These sprites move and will go through openings if it's open at the
   level they are at.  It should however be easy to change them to
   ACTOR STAYPUTs so they stay in their sectors.  That just didn't work
   for me since I had alot of sectors that where small.

   It seems you can't start a MAKER close to other sprites.  If you do, the
   snow will get confused and stay on the ceiling.  It's really weird.

   Oh.. I wouldn't put more than 15 or so in an area.. you will kill
   yourself.


*/

define SNOWFLAKE        3697  // The small Snowflake sprite
define SNOWMAKER        3787  // The BIG snowflake sprite
define SNOWMAKERNOMOVE  3789  // Same as above.. just different slot

// The Snowmaker is the actor that tosses out new snowflakes.

action SNOWMAKE
move SNOWMAKERMOVE 100 0  // Use this to adjust the speed at which the
                          // SNOWMAKER's move

ai AISNOWMAKERROAM SNOWMAKE SNOWMAKERMOVE getv geth randomangle

actor SNOWMAKER 0 0 randomangle
    cstat 32768

    // I start by spawning a snowflake.

    ifai NO
    {
      spawn SNOWFLAKE
      ai AISNOWMAKERROAM
      break
    }

    // Anytime the maker stops.. bounce it again

    ifnotmoving
    {
        ai AISNOWMAKERROAM
    }

    // the IFCOUNT sets the frequency that it drops snow

    ifspritepal 0
    {
      ifcount 48
      {

        ifcansee
          spawn SNOWFLAKE
        ai AISNOWMAKERROAM
        resetcount
      }
    }

    ifspritepal 1
    {
      ifcount 32
      {
        ifcansee
          spawn SNOWFLAKE
        ai AISNOWMAKERROAM
        resetcount
      }
    }
    ifspritepal 2
    {
      ifcount 64
      {
        ifcansee
          spawn SNOWFLAKE
        ai AISNOWMAKERROAM
        resetcount
      }
    }
    ifspritepal 3
    {
      ifcount 96
      {
        ifcansee
          spawn SNOWFLAKE
        ai AISNOWMAKERROAM
        resetcount
      }
    }
    ifspritepal 4
    {
      ifcount 16
      {
        ifcansee
          spawn SNOWFLAKE
        ai AISNOWMAKERROAM
        resetcount
      }
    }


enda

// The SnowMakerNoMove is the actor that tosses out snowflakes from a
// single position.

actor SNOWMAKERNOMOVE 0 0 randomangle
    cstat 32768

    ifspritepal 0
    {
      ifcount 32
      {
        spawn SNOWFLAKE
        resetcount
      }
    }

    ifspritepal 1
    {
      ifcount 48
      {
        ifcansee
          spawn SNOWFLAKE
        resetcount
      }
    }
    ifspritepal 2
    {
      ifcount 64
      {
        ifcansee
          spawn SNOWFLAKE
        resetcount
      }
    }
    ifspritepal 3
    {
      ifcount 96
      {
        ifcansee
          spawn SNOWFLAKE
        resetcount
      }
    }
    ifspritepal 4
    {
      ifcount 16
      {
        ifcansee
          spawn SNOWFLAKE
        resetcount
      }
    }


enda

action SNOW
move SNOWMOVE       -25 40   // You can tweak the motion here

actor SNOWFLAKE 0 SNOW SNOWMOVE getv geth randomangle

  sizeto 25 25
  cstat 0

  ifcount 4
  {
    move SNOWMOVE getv geth randomangle
    resetcount
    break
  }

  // Unlike the original code from Mystique, these flakes die when they
  // hit the ground.. Works much better.

  iffloordistl 5
  {
    killit
  }


enda
