Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*
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 : Blizzard
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 were 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.
--------------------------------------------------------------------------------
Duke: Nuclear Winter
By Joris Weimar
© 1997 Simply Silly Software
--------------------------------------------------------------------------------
Duke: Nuclear Winter Plus
By Hendricks266
--------------------------------------------------------------------------------
*/
// 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
useractor notenemy SNOWMAKER 0 0 randomangle
cstat 32768
// I start by spawning a snowflake.
ifai 0
{
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.
useractor notenemy 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 ASNOW
move SNOWMOVE -25 40 // You can tweak the motion here
useractor notenemy SNOWFLAKE 0 ASNOW SNOWMOVE getv geth randomangle
sizeat 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
// Unlike the original snow from Joe Wilcox, these flakes have significant
// improvements in both code and looks.
// I (Hendricks266) have changed the incredibly ugly snow tile to a more
// detailed one with a smaller in-game size.
setactor[THISACTOR].mdflags 16
ifnotmoving killit
enda
// Hendricks266's much better Snow
/*
ActorExtra[i].floorz = s->z = getflorzofslope(s->sectnum,s->x,s->y);
s->xvel = (krand()&7)+(sintable[T1&2047]>>9);
T1 += (krand()&63);
if ((T1&2047) > 512 && (T1&2047) < 1596)
{
if (sector[sect].lotag == 2)
{
if (s->zvel < 64)
s->zvel += (g_spriteGravity>>5)+(krand()&7);
}
else if (s->zvel < 144)
s->zvel += (g_spriteGravity>>5)+(krand()&7);
}
A_SetSprite(i,CLIPMASK0);
if ((krand()&3) == 0)
setsprite(i,(vec3_t *)s);
if (s->sectnum == -1) KILLIT(i);
l = getflorzofslope(s->sectnum,s->x,s->y);
if (s->z > l)
{
s->z = l;
A_AddToDeleteQueue(i);
PN ++;
j = headspritestat[STAT_MISC];
while (j >= 0)
{
if (sprite[j].picnum == BLOODPOOL)
if (ldist(s,&sprite[j]) < 348)
{
s->pal = 2;
break;
}
j = nextspritestat[j];
}
}
if (sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER)
{
ActorExtra[i].temp_data[0] = krand()&2047;
sp->cstat = krand()&12;
sp->xrepeat = sp->yrepeat = 8;
sp->ang = krand()&2047;
}
changespritestat(i,5);
*/
useractor notenemy SNOW 0
sizeat 4 4
addvar nw_temp2 16
ifvarg nw_temp2 2047 subvar nw_temp2 4095
setvarvar nw_temp3 nw_temp2
sin nw_temp3 nw_temp3
shiftvarr nw_temp3 5
/*
getactor[THISACTOR].x nw_x
getactor[THISACTOR].y nw_y
getactor[THISACTOR].z nw_z
updatesectorz nw_x nw_y nw_z nw_temp
getactor[THISACTOR].zvel nw_z
ifvare sector[nw_temp].lotag 2
{
ifvarl nw_z 64
{
setvar nw_tempb GRAVITATIONALCONSTANT
shiftvarr nw_tempb 5
addvarvar nw_tempb temp4
addvarvar nw_z nw_tempb
}
}
else
{
ifvarl nw_z 144
{
setvar nw_tempb GRAVITATIONALCONSTANT
shiftvarr nw_tempb 5
addvarvar nw_tempb temp4
addvarvar nw_z nw_tempb
}
}
*/
movesprite THISACTOR nw_temp3 0 256 CLIPMASK0 RETURN
ifvarn RETURN 0 killit
getactor[THISACTOR].x nw_x
getactor[THISACTOR].y nw_y
getactor[THISACTOR].z nw_z
updatesectorz nw_x nw_y nw_z nw_temp
ifvarn nw_temp -1 getflorzofslope nw_temp nw_x nw_y nw_temp2 else killit
ifvarvare nw_z nw_temp2 killit
enda