Subversion Repositories nw_plus

Rev

Rev 1 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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