Subversion Repositories nw_plus

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 h266 1
/*
2
 
3
  Better Falling Snow by Joe Wilcox
4
  (c) 1997, Simply Silly Software
5
 
6
  You need to add 3 sprites to your ART tiles and reference them below.
7
  I've included our default sprites.. feel free to use them.
8
 
9
  The 2 Snow Makers use their palettes to determine how often to spawn
10
  snow.  It goes as follows:
11
 
12
   Pal 0  : Lite Snow Storm
13
   Pal 1  : Medium Snow Storm
14
   Pal 2  : Very Lite Snow Storm
15
   Pal 3  : Flurries
16
   Pal 4  : Blizzard
17
 
18
 
19
   The snowflake can be added by itself to give the appearance of it
20
   already snowing.  SNOWMAKER will roam around the screen dropping a
21
   flake every now and this.  This looks really good.  SNOWMAKERNOMOVE
22
   stands in once place.  You want to use this for holes in ceilings and
23
   other small areas.
24
 
25
   There are some limitations:
26
 
27
   These sprites move and will go through openings if it's open at the
28
   level they are at.  It should however be easy to change them to
29
   ACTOR STAYPUTs so they stay in their sectors.  That just didn't work
30
   for me since I had alot of sectors that were small.
31
 
32
   It seems you can't start a MAKER close to other sprites.  If you do, the
33
   snow will get confused and stay on the ceiling.  It's really weird.
34
 
35
   Oh.. I wouldn't put more than 15 or so in an area.. you will kill
36
   yourself.
37
--------------------------------------------------------------------------------
38
Duke: Nuclear Winter
39
By Joris Weimar
40
© 1997 Simply Silly Software
41
--------------------------------------------------------------------------------
42
Duke: Nuclear Winter Plus
43
By Hendricks266
44
--------------------------------------------------------------------------------
45
*/
46
 
47
// The Snowmaker is the actor that tosses out new snowflakes.
48
 
49
action SNOWMAKE
50
move SNOWMAKERMOVE 100 0  // Use this to adjust the speed at which the
51
                          // SNOWMAKER's move
52
 
53
ai AISNOWMAKERROAM SNOWMAKE SNOWMAKERMOVE getv geth randomangle
54
 
55
useractor notenemy SNOWMAKER 0 0 randomangle
56
    cstat 32768
57
 
58
    // I start by spawning a snowflake.
59
 
60
    ifai 0
61
    {
62
      spawn SNOWFLAKE
63
      ai AISNOWMAKERROAM
64
      break
65
    }
66
 
67
    // Anytime the maker stops.. bounce it again
68
 
69
    ifnotmoving
70
    {
71
        ai AISNOWMAKERROAM
72
    }
73
 
74
    // the IFCOUNT sets the frequency that it drops snow
75
 
76
    ifspritepal 0
77
    {
78
      ifcount 48
79
      {
80
 
81
        ifcansee
82
          spawn SNOWFLAKE
83
        ai AISNOWMAKERROAM
84
        resetcount
85
      }
86
    }
87
 
88
    ifspritepal 1
89
    {
90
      ifcount 32
91
      {
92
        ifcansee
93
          spawn SNOWFLAKE
94
        ai AISNOWMAKERROAM
95
        resetcount
96
      }
97
    }
98
    ifspritepal 2
99
    {
100
      ifcount 64
101
      {
102
        ifcansee
103
          spawn SNOWFLAKE
104
        ai AISNOWMAKERROAM
105
        resetcount
106
      }
107
    }
108
    ifspritepal 3
109
    {
110
      ifcount 96
111
      {
112
        ifcansee
113
          spawn SNOWFLAKE
114
        ai AISNOWMAKERROAM
115
        resetcount
116
      }
117
    }
118
    ifspritepal 4
119
    {
120
      ifcount 16
121
      {
122
        ifcansee
123
          spawn SNOWFLAKE
124
        ai AISNOWMAKERROAM
125
        resetcount
126
      }
127
    }
128
 
129
 
130
enda
131
 
132
// The SnowMakerNoMove is the actor that tosses out snowflakes from a
133
// single position.
134
 
135
useractor notenemy SNOWMAKERNOMOVE 0 0 randomangle
136
    cstat 32768
137
 
138
    ifspritepal 0
139
    {
140
      ifcount 32
141
      {
142
        spawn SNOWFLAKE
143
        resetcount
144
      }
145
    }
146
 
147
    ifspritepal 1
148
    {
149
      ifcount 48
150
      {
151
        ifcansee
152
          spawn SNOWFLAKE
153
        resetcount
154
      }
155
    }
156
    ifspritepal 2
157
    {
158
      ifcount 64
159
      {
160
        ifcansee
161
          spawn SNOWFLAKE
162
        resetcount
163
      }
164
    }
165
    ifspritepal 3
166
    {
167
      ifcount 96
168
      {
169
        ifcansee
170
          spawn SNOWFLAKE
171
        resetcount
172
      }
173
    }
174
    ifspritepal 4
175
    {
176
      ifcount 16
177
      {
178
        ifcansee
179
          spawn SNOWFLAKE
180
        resetcount
181
      }
182
    }
183
 
184
 
185
enda
186
 
187
action ASNOW
188
move SNOWMOVE       -25 40   // You can tweak the motion here
189
 
190
useractor notenemy SNOWFLAKE 0 ASNOW SNOWMOVE getv geth randomangle
191
 
192
  sizeat 25 25
193
  cstat 0
194
 
195
  ifcount 4
196
  {
197
    move SNOWMOVE getv geth randomangle
198
    resetcount
199
    break
200
  }
201
 
202
  // Unlike the original code from Mystique, these flakes die when they
203
  // hit the ground.. Works much better.
204
 
205
  iffloordistl 5 killit
206
 
207
  // Unlike the original snow from Joe Wilcox, these flakes have significant
208
  // improvements in both code and looks.
209
  // I (Hendricks266) have changed the incredibly ugly snow tile to a more
210
  // detailed one with a smaller in-game size.
211
 
212
  setactor[THISACTOR].mdflags 16
213
  ifnotmoving killit
214
enda
215
 
216
 
217
 
218
 
219
 
220
// Hendricks266's much better Snow
221
 
222
/*
223
ActorExtra[i].floorz = s->z = getflorzofslope(s->sectnum,s->x,s->y);
224
 
225
 
226
                s->xvel = (krand()&7)+(sintable[T1&2047]>>9);
227
                T1 += (krand()&63);
228
                if ((T1&2047) > 512 && (T1&2047) < 1596)
229
                {
230
                    if (sector[sect].lotag == 2)
231
                    {
232
                        if (s->zvel < 64)
233
                            s->zvel += (g_spriteGravity>>5)+(krand()&7);
234
                    }
235
                    else if (s->zvel < 144)
236
                        s->zvel += (g_spriteGravity>>5)+(krand()&7);
237
                }
238
 
239
                A_SetSprite(i,CLIPMASK0);
240
 
241
                if ((krand()&3) == 0)
242
                    setsprite(i,(vec3_t *)s);
243
 
244
                if (s->sectnum == -1) KILLIT(i);
245
                l = getflorzofslope(s->sectnum,s->x,s->y);
246
 
247
                if (s->z > l)
248
                {
249
                    s->z = l;
250
 
251
                    A_AddToDeleteQueue(i);
252
                    PN ++;
253
 
254
                    j = headspritestat[STAT_MISC];
255
                    while (j >= 0)
256
                    {
257
                        if (sprite[j].picnum == BLOODPOOL)
258
                            if (ldist(s,&sprite[j]) < 348)
259
                            {
260
                                s->pal = 2;
261
                                break;
262
                            }
263
                        j = nextspritestat[j];
264
                    }
265
                }
266
 
267
 
268
            if (sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER)
269
            {
270
                ActorExtra[i].temp_data[0] = krand()&2047;
271
                sp->cstat = krand()&12;
272
                sp->xrepeat = sp->yrepeat = 8;
273
                sp->ang = krand()&2047;
274
            }
275
            changespritestat(i,5);
276
*/
277
 
278
 
279
useractor notenemy SNOW 0
280
  sizeat 4 4
281
 
66 h266 282
  addvar nw_temp2 16
283
  ifvarg nw_temp2 2047 subvar nw_temp2 4095
284
  setvarvar nw_temp3 nw_temp2
285
  sin nw_temp3 nw_temp3
286
  shiftvarr nw_temp3 5
1 h266 287
 
288
/*
66 h266 289
  getactor[THISACTOR].x nw_x
290
  getactor[THISACTOR].y nw_y
291
  getactor[THISACTOR].z nw_z
1 h266 292
 
66 h266 293
  updatesectorz nw_x nw_y nw_z nw_temp
294
  getactor[THISACTOR].zvel nw_z
295
  ifvare sector[nw_temp].lotag 2
1 h266 296
    {
66 h266 297
      ifvarl nw_z 64
1 h266 298
        {
66 h266 299
          setvar nw_tempb GRAVITATIONALCONSTANT
300
          shiftvarr nw_tempb 5
301
          addvarvar nw_tempb temp4
302
          addvarvar nw_z nw_tempb
1 h266 303
        }
304
    }
305
  else
306
    {
66 h266 307
      ifvarl nw_z 144
1 h266 308
        {
66 h266 309
          setvar nw_tempb GRAVITATIONALCONSTANT
310
          shiftvarr nw_tempb 5
311
          addvarvar nw_tempb temp4
312
          addvarvar nw_z nw_tempb
1 h266 313
        }
314
    }
315
*/
316
 
66 h266 317
  movesprite THISACTOR nw_temp3 0 256 CLIPMASK0 RETURN
1 h266 318
  ifvarn RETURN 0 killit
319
 
320
 
66 h266 321
  getactor[THISACTOR].x nw_x
322
  getactor[THISACTOR].y nw_y
323
  getactor[THISACTOR].z nw_z
1 h266 324
 
66 h266 325
  updatesectorz nw_x nw_y nw_z nw_temp
326
  ifvarn nw_temp -1 getflorzofslope nw_temp nw_x nw_y nw_temp2 else killit
1 h266 327
 
66 h266 328
  ifvarvare nw_z nw_temp2 killit
1 h266 329
 
330
enda