1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
|
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 1993-2008 Raven Software
// Copyright(C) 2008 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
//-----------------------------------------------------------------------------
#include "h2def.h"
#include "m_random.h"
#include "i_cdmus.h"
#include "i_sound.h"
#include "i_system.h"
#include "i_timer.h"
#include "m_argv.h"
#include "m_misc.h"
#include "r_local.h"
#include "p_local.h" // for P_AproxDistance
#include "sounds.h"
#include "s_sound.h"
#define PRIORITY_MAX_ADJUST 10
#define DIST_ADJUST (MAX_SND_DIST/PRIORITY_MAX_ADJUST)
#define DEFAULT_ARCHIVEPATH "o:\\sound\\archive\\"
void S_ShutDown(void);
// If true, CD music playback is enabled (snd_musicdevice == SNDDEVICE_CD
// and CD initialization succeeded).
boolean cdmusic;
// Track number of a track to play explicitly chosen by the
// player using cheats. A value of zero means no track chosen:
static int cd_custom_track = 0;
// Currently playing track:
static int cd_current_track = 0;
// Time (MS) at which the currently-playing CD track will finish playing
// and should be looped. Zero if we are not currently playing a track:
static int cd_track_end_time = 0;
/*
===============================================================================
MUSIC & SFX API
===============================================================================
*/
//static channel_t channel[MAX_CHANNELS];
//static int rs; //the current registered song.
//int mus_song = -1;
//int mus_lumpnum;
//void *mus_sndptr;
//byte *soundCurve;
extern sfxinfo_t S_sfx[];
extern musicinfo_t S_music[];
static channel_t Channel[MAX_CHANNELS];
static void *RegisteredSong; //the current registered song.
static boolean MusicPaused;
static int Mus_Song = -1;
static byte *Mus_SndPtr;
static byte *SoundCurve;
int snd_MaxVolume = 10; // maximum volume for sound
int snd_MusicVolume = 10; // maximum volume for music
int snd_Channels = 16;
// int AmbChan;
//==========================================================================
//
// S_Start
//
//==========================================================================
void S_Start(void)
{
S_StopAllSound();
S_StartSong(gamemap, true);
}
//==========================================================================
//
// Returns true if we are playing a looping CD track and it is time to
// restart it.
//
//==========================================================================
static boolean ShouldRestartCDTrack(void)
{
return cd_track_end_time != 0 && I_GetTimeMS() > cd_track_end_time;
}
//==========================================================================
//
// Start playing a CD track. Returns true for success.
//
//==========================================================================
static boolean StartCDTrack(int track, boolean loop)
{
// Already playing? If so, don't bother.
if (track == cd_current_track && !ShouldRestartCDTrack())
{
return true;
}
if (I_CDMusPlay(track))
{
return false;
}
cd_current_track = track;
if (loop)
{
cd_track_end_time = I_GetTimeMS() + 1000 * I_CDMusTrackLength(track);
}
else
{
cd_track_end_time = 0;
}
return true;
}
//==========================================================================
//
// S_StartSong
//
//==========================================================================
void S_StartSong(int song, boolean loop)
{
char *songLump;
int lumpnum;
int length;
int track;
// If we're in CD music mode, play a CD track, instead:
if (cdmusic)
{
// Default to the player-chosen track
if (cd_custom_track != 0)
{
track = cd_custom_track;
}
else
{
track = P_GetMapCDTrack(gamemap);
}
StartCDTrack(track, loop);
}
else
{
if (song == Mus_Song)
{ // don't replay an old song
return;
}
if (RegisteredSong)
{
I_StopSong();
I_UnRegisterSong(RegisteredSong);
RegisteredSong = 0;
}
songLump = P_GetMapSongLump(song);
if (!songLump)
{
return;
}
lumpnum = W_GetNumForName(songLump);
Mus_SndPtr = W_CacheLumpNum(lumpnum, PU_STATIC);
length = W_LumpLength(lumpnum);
RegisteredSong = I_RegisterSong(Mus_SndPtr, length);
I_PlaySong(RegisteredSong, loop);
Mus_Song = song;
W_ReleaseLumpNum(lumpnum);
}
}
//==========================================================================
//
// Play a custom-chosen music track selected by the player.
//
// Returns true for success.
//
//==========================================================================
boolean S_StartCustomCDTrack(int tracknum)
{
boolean result;
result = StartCDTrack(tracknum, true);
if (result)
{
cd_custom_track = tracknum;
}
return result;
}
//==========================================================================
//
// Get the currently-playing CD track; returns -1 if not playing.
//
//==========================================================================
int S_GetCurrentCDTrack(void)
{
if (!cdmusic || cd_current_track == 0)
{
return -1;
}
return cd_current_track;
}
//==========================================================================
//
// S_StartSongName
//
//==========================================================================
void S_StartSongName(char *songLump, boolean loop)
{
int lumpnum;
int cdTrack;
int length;
if (!songLump)
{
return;
}
if (cdmusic)
{
cdTrack = 0;
if (!strcmp(songLump, "hexen"))
{
cdTrack = P_GetCDTitleTrack();
}
else if (!strcmp(songLump, "hub"))
{
cdTrack = P_GetCDIntermissionTrack();
}
else if (!strcmp(songLump, "hall"))
{
cdTrack = P_GetCDEnd1Track();
}
else if (!strcmp(songLump, "orb"))
{
cdTrack = P_GetCDEnd2Track();
}
else if (!strcmp(songLump, "chess") && cd_custom_track == 0)
{
cdTrack = P_GetCDEnd3Track();
}
/* Uncomment this, if Kevin writes a specific song for startup
else if(!strcmp(songLump, "start"))
{
cdTrack = P_GetCDStartTrack();
}
*/
if (cdTrack != 0)
{
cd_custom_track = 0;
StartCDTrack(cdTrack, loop);
}
}
else
{
if (RegisteredSong)
{
I_StopSong();
I_UnRegisterSong(RegisteredSong);
RegisteredSong = NULL;
}
lumpnum = W_GetNumForName(songLump);
Mus_SndPtr = W_CacheLumpNum(lumpnum, PU_MUSIC);
length = W_LumpLength(lumpnum);
RegisteredSong = I_RegisterSong(Mus_SndPtr, length);
I_PlaySong(RegisteredSong, loop);
W_ReleaseLumpNum(lumpnum);
Mus_Song = -1;
}
}
//==========================================================================
//
// S_GetSoundID
//
//==========================================================================
int S_GetSoundID(char *name)
{
int i;
for (i = 0; i < NUMSFX; i++)
{
if (!strcmp(S_sfx[i].tagname, name))
{
return i;
}
}
return 0;
}
//==========================================================================
//
// S_StartSound
//
//==========================================================================
void S_StartSound(mobj_t * origin, int sound_id)
{
S_StartSoundAtVolume(origin, sound_id, 127);
}
static mobj_t *GetSoundListener(void)
{
static degenmobj_t dummy_listener;
// If we are at the title screen, the console player doesn't have an
// object yet, so return a pointer to a static dummy listener instead.
if (players[displayplayer].mo != NULL)
{
return players[displayplayer].mo;
}
else
{
dummy_listener.x = 0;
dummy_listener.y = 0;
dummy_listener.z = 0;
return (mobj_t *) &dummy_listener;
}
}
//==========================================================================
//
// S_StartSoundAtVolume
//
//==========================================================================
void S_StartSoundAtVolume(mobj_t * origin, int sound_id, int volume)
{
mobj_t *listener;
int dist, vol;
int i;
int priority;
int sep;
int angle;
int absx;
int absy;
static int sndcount = 0;
int chan;
if (sound_id == 0 || snd_MaxVolume == 0)
return;
listener = GetSoundListener();
if (origin == NULL)
{
origin = listener;
}
if (volume == 0)
{
return;
}
// calculate the distance before other stuff so that we can throw out
// sounds that are beyond the hearing range.
absx = abs(origin->x - listener->x);
absy = abs(origin->y - listener->y);
dist = absx + absy - (absx > absy ? absy >> 1 : absx >> 1);
dist >>= FRACBITS;
if (dist >= MAX_SND_DIST)
{
return; // sound is beyond the hearing range...
}
if (dist < 0)
{
dist = 0;
}
priority = S_sfx[sound_id].priority;
priority *= (PRIORITY_MAX_ADJUST - (dist / DIST_ADJUST));
#if 0
// TODO
if (!S_StopSoundID(sound_id, priority))
{
return; // other sounds have greater priority
}
#endif
for (i = 0; i < snd_Channels; i++)
{
if (origin->player)
{
i = snd_Channels;
break; // let the player have more than one sound.
}
if (origin == Channel[i].mo)
{ // only allow other mobjs one sound
S_StopSound(Channel[i].mo);
break;
}
}
if (i >= snd_Channels)
{
for (i = 0; i < snd_Channels; i++)
{
if (Channel[i].mo == NULL)
{
break;
}
}
if (i >= snd_Channels)
{
// look for a lower priority sound to replace.
sndcount++;
if (sndcount >= snd_Channels)
{
sndcount = 0;
}
for (chan = 0; chan < snd_Channels; chan++)
{
i = (sndcount + chan) % snd_Channels;
if (priority >= Channel[i].priority)
{
chan = -1; //denote that sound should be replaced.
break;
}
}
if (chan != -1)
{
return; //no free channels.
}
else //replace the lower priority sound.
{
if (Channel[i].handle)
{
if (I_SoundIsPlaying(Channel[i].handle))
{
I_StopSound(Channel[i].handle);
}
if (S_sfx[Channel[i].sound_id].usefulness > 0)
{
S_sfx[Channel[i].sound_id].usefulness--;
}
}
}
}
}
Channel[i].mo = origin;
vol = (SoundCurve[dist] * (snd_MaxVolume * 8) * volume) >> 14;
if (origin == listener)
{
sep = 128;
// vol = (volume*(snd_MaxVolume+1)*8)>>7;
}
else
{
angle = R_PointToAngle2(listener->x,
listener->y,
Channel[i].mo->x, Channel[i].mo->y);
angle = (angle - viewangle) >> 24;
sep = angle * 2 - 128;
if (sep < 64)
sep = -sep;
if (sep > 192)
sep = 512 - sep;
// vol = SoundCurve[dist];
}
#if 0
// TODO
if (S_sfx[sound_id].changePitch)
{
Channel[i].pitch = (byte) (127 + (M_Random() & 7) - (M_Random() & 7));
}
else
{
Channel[i].pitch = 127;
}
#endif
if (S_sfx[sound_id].lumpnum == 0)
{
S_sfx[sound_id].lumpnum = I_GetSfxLumpNum(&S_sfx[sound_id]);
}
Channel[i].handle = I_StartSound(&S_sfx[sound_id],
i,
vol,
sep /* , Channel[i].pitch] */);
Channel[i].sound_id = sound_id;
Channel[i].priority = priority;
Channel[i].volume = volume;
if (S_sfx[sound_id].usefulness < 0)
{
S_sfx[sound_id].usefulness = 1;
}
else
{
S_sfx[sound_id].usefulness++;
}
}
//==========================================================================
//
// S_StopSoundID
//
//==========================================================================
boolean S_StopSoundID(int sound_id, int priority)
{
int i;
int lp; //least priority
int found;
if (S_sfx[sound_id].numchannels == -1)
{
return (true);
}
lp = -1; //denote the argument sound_id
found = 0;
for (i = 0; i < snd_Channels; i++)
{
if (Channel[i].sound_id == sound_id && Channel[i].mo)
{
found++; //found one. Now, should we replace it??
if (priority >= Channel[i].priority)
{ // if we're gonna kill one, then this'll be it
lp = i;
priority = Channel[i].priority;
}
}
}
if (found < S_sfx[sound_id].numchannels)
{
return (true);
}
else if (lp == -1)
{
return (false); // don't replace any sounds
}
if (Channel[lp].handle)
{
if (I_SoundIsPlaying(Channel[lp].handle))
{
I_StopSound(Channel[lp].handle);
}
if (S_sfx[Channel[lp].sound_id].usefulness > 0)
{
S_sfx[Channel[lp].sound_id].usefulness--;
}
Channel[lp].mo = NULL;
}
return (true);
}
//==========================================================================
//
// S_StopSound
//
//==========================================================================
void S_StopSound(mobj_t * origin)
{
int i;
for (i = 0; i < snd_Channels; i++)
{
if (Channel[i].mo == origin)
{
I_StopSound(Channel[i].handle);
if (S_sfx[Channel[i].sound_id].usefulness > 0)
{
S_sfx[Channel[i].sound_id].usefulness--;
}
Channel[i].handle = 0;
Channel[i].mo = NULL;
}
}
}
//==========================================================================
//
// S_StopAllSound
//
//==========================================================================
void S_StopAllSound(void)
{
int i;
//stop all sounds
for (i = 0; i < snd_Channels; i++)
{
if (Channel[i].handle)
{
S_StopSound(Channel[i].mo);
}
}
memset(Channel, 0, 8 * sizeof(channel_t));
}
//==========================================================================
//
// S_SoundLink
//
//==========================================================================
void S_SoundLink(mobj_t * oldactor, mobj_t * newactor)
{
int i;
for (i = 0; i < snd_Channels; i++)
{
if (Channel[i].mo == oldactor)
Channel[i].mo = newactor;
}
}
//==========================================================================
//
// S_PauseSound
//
//==========================================================================
void S_PauseSound(void)
{
if (cdmusic)
{
I_CDMusStop();
}
else
{
I_PauseSong();
}
}
//==========================================================================
//
// S_ResumeSound
//
//==========================================================================
void S_ResumeSound(void)
{
if (cdmusic)
{
I_CDMusResume();
}
else
{
I_ResumeSong();
}
}
//==========================================================================
//
// S_UpdateSounds
//
//==========================================================================
void S_UpdateSounds(mobj_t * listener)
{
int i, dist, vol;
int angle;
int sep;
int priority;
int absx;
int absy;
// If we are looping a CD track, we need to check if it has
// finished playing and needs to restart.
if (cdmusic && ShouldRestartCDTrack())
{
StartCDTrack(cd_current_track, true);
}
if (snd_MaxVolume == 0)
{
return;
}
// Update any Sequences
SN_UpdateActiveSequences();
for (i = 0; i < snd_Channels; i++)
{
if (!Channel[i].handle || S_sfx[Channel[i].sound_id].usefulness == -1)
{
continue;
}
if (!I_SoundIsPlaying(Channel[i].handle))
{
if (S_sfx[Channel[i].sound_id].usefulness > 0)
{
S_sfx[Channel[i].sound_id].usefulness--;
}
Channel[i].handle = 0;
Channel[i].mo = NULL;
Channel[i].sound_id = 0;
}
if (Channel[i].mo == NULL || Channel[i].sound_id == 0
|| Channel[i].mo == listener || listener == NULL)
{
continue;
}
else
{
absx = abs(Channel[i].mo->x - listener->x);
absy = abs(Channel[i].mo->y - listener->y);
dist = absx + absy - (absx > absy ? absy >> 1 : absx >> 1);
dist >>= FRACBITS;
if (dist >= MAX_SND_DIST)
{
S_StopSound(Channel[i].mo);
continue;
}
if (dist < 0)
{
dist = 0;
}
//vol = SoundCurve[dist];
vol =
(SoundCurve[dist] * (snd_MaxVolume * 8) *
Channel[i].volume) >> 14;
if (Channel[i].mo == listener)
{
sep = 128;
}
else
{
angle = R_PointToAngle2(listener->x, listener->y,
Channel[i].mo->x, Channel[i].mo->y);
angle = (angle - viewangle) >> 24;
sep = angle * 2 - 128;
if (sep < 64)
sep = -sep;
if (sep > 192)
sep = 512 - sep;
}
I_UpdateSoundParams(i, vol, sep /*, Channel[i].pitch */);
priority = S_sfx[Channel[i].sound_id].priority;
priority *= PRIORITY_MAX_ADJUST - (dist / DIST_ADJUST);
Channel[i].priority = priority;
}
}
}
//==========================================================================
//
// S_Init
//
//==========================================================================
void S_Init(void)
{
SoundCurve = W_CacheLumpName("SNDCURVE", PU_STATIC);
// SoundCurve = Z_Malloc(MAX_SND_DIST, PU_STATIC, NULL);
I_InitSound(false);
if (snd_Channels > 8)
{
snd_Channels = 8;
}
I_SetMusicVolume(snd_MusicVolume * 8);
I_AtExit(S_ShutDown, true);
I_PrecacheSounds(S_sfx, NUMSFX);
// Attempt to setup CD music
if (snd_musicdevice == SNDDEVICE_CD)
{
ST_Message(" Attempting to initialize CD Music: ");
if (!cdrom)
{
cdmusic = (I_CDMusInit() != -1);
}
else
{
// The user is trying to use the cdrom for both game and music
cdmusic = false;
}
if (cdmusic)
{
ST_Message("initialized.\n");
}
else
{
ST_Message("failed.\n");
}
I_CDMusPrintStartup();
}
}
//==========================================================================
//
// S_GetChannelInfo
//
//==========================================================================
void S_GetChannelInfo(SoundInfo_t * s)
{
int i;
ChanInfo_t *c;
s->channelCount = snd_Channels;
s->musicVolume = snd_MusicVolume;
s->soundVolume = snd_MaxVolume;
for (i = 0; i < snd_Channels; i++)
{
c = &s->chan[i];
c->id = Channel[i].sound_id;
c->priority = Channel[i].priority;
c->name = S_sfx[c->id].name;
c->mo = Channel[i].mo;
if (c->mo != NULL)
{
c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
>> FRACBITS;
}
else
{
c->distance = 0;
}
}
}
//==========================================================================
//
// S_GetSoundPlayingInfo
//
//==========================================================================
boolean S_GetSoundPlayingInfo(mobj_t * mobj, int sound_id)
{
int i;
for (i = 0; i < snd_Channels; i++)
{
if (Channel[i].sound_id == sound_id && Channel[i].mo == mobj)
{
if (I_SoundIsPlaying(Channel[i].handle))
{
return true;
}
}
}
return false;
}
//==========================================================================
//
// S_SetMusicVolume
//
//==========================================================================
void S_SetMusicVolume(void)
{
if (cdmusic)
{
I_CDMusSetVolume(snd_MusicVolume * 16); // 0-255
}
else
{
I_SetMusicVolume(snd_MusicVolume * 8);
}
if (snd_MusicVolume == 0)
{
if (!cdmusic)
{
I_PauseSong();
}
MusicPaused = true;
}
else if (MusicPaused)
{
if (!cdmusic)
{
I_ResumeSong();
}
MusicPaused = false;
}
}
//==========================================================================
//
// S_ShutDown
//
//==========================================================================
void S_ShutDown(void)
{
I_StopSong();
I_UnRegisterSong(RegisteredSong);
I_ShutdownSound();
if (cdmusic)
{
I_CDMusStop();
}
}
//==========================================================================
//
// S_InitScript
//
//==========================================================================
void S_InitScript(void)
{
int i;
SC_OpenLump("sndinfo");
while (SC_GetString())
{
if (*sc_String == '$')
{
if (!strcasecmp(sc_String, "$ARCHIVEPATH"))
{
SC_MustGetString();
}
else if (!strcasecmp(sc_String, "$MAP"))
{
SC_MustGetNumber();
SC_MustGetString();
if (sc_Number)
{
P_PutMapSongLump(sc_Number, sc_String);
}
}
continue;
}
else
{
for (i = 0; i < NUMSFX; i++)
{
if (!strcmp(S_sfx[i].tagname, sc_String))
{
SC_MustGetString();
if (*sc_String != '?')
{
strcpy(S_sfx[i].name, sc_String);
}
else
{
strcpy(S_sfx[i].name, "default");
}
break;
}
}
if (i == NUMSFX)
{
SC_MustGetString();
}
}
}
SC_Close();
for (i = 0; i < NUMSFX; i++)
{
if (!strcmp(S_sfx[i].name, ""))
{
strcpy(S_sfx[i].name, "default");
}
}
}
|