mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- made RR thunder effect also work for Duke.
This mainly meant adding support for random sounds and playing the thunder sound by name instead of by index.
This commit is contained in:
parent
0cd0f28317
commit
810977f19f
4 changed files with 38 additions and 6 deletions
|
@ -52,6 +52,7 @@
|
|||
|
||||
enum SICommands
|
||||
{
|
||||
SI_Random,
|
||||
SI_MusicVolume,
|
||||
SI_MidiDevice,
|
||||
SI_MusicAlias,
|
||||
|
@ -87,6 +88,7 @@ static void S_AddSNDINFO (int lumpnum);
|
|||
|
||||
static const char *SICommandStrings[] =
|
||||
{
|
||||
"$random",
|
||||
"$musicvolume",
|
||||
"$mididevice",
|
||||
"$musicalias",
|
||||
|
@ -164,7 +166,7 @@ FSoundID S_AddSound(const char* logicalname, const char* lumpname, FScanner* sc)
|
|||
static void S_AddSNDINFO (int lump)
|
||||
{
|
||||
bool skipToEndIf;
|
||||
TArray<uint32_t> list;
|
||||
TArray<FSoundID> list;
|
||||
int wantassigns = -1;
|
||||
|
||||
FScanner sc(lump);
|
||||
|
@ -187,6 +189,37 @@ static void S_AddSNDINFO (int lump)
|
|||
{ // Got a command
|
||||
switch (cmd)
|
||||
{
|
||||
case SI_Random: {
|
||||
// $random <logical name> { <logical name> ... }
|
||||
FRandomSoundList random;
|
||||
|
||||
list.Clear();
|
||||
sc.MustGetString();
|
||||
FSoundID Owner = S_AddSound(sc.String, -1, &sc);
|
||||
sc.MustGetStringName("{");
|
||||
while (sc.GetString() && !sc.Compare("}"))
|
||||
{
|
||||
FSoundID sfxto = soundEngine->FindSoundTentative(sc.String);
|
||||
if (sfxto == random.Owner)
|
||||
{
|
||||
Printf("Definition of random sound '%s' refers to itself recursively.\n", sc.String);
|
||||
continue;
|
||||
}
|
||||
list.Push(sfxto);
|
||||
}
|
||||
if (list.Size() == 1)
|
||||
{ // Only one sound: treat as $alias
|
||||
auto sfxp = soundEngine->GetWritableSfx(Owner);
|
||||
sfxp->link = list[0];
|
||||
sfxp->NearLimit = -1;
|
||||
}
|
||||
else if (list.Size() > 1)
|
||||
{ // Only add non-empty random lists
|
||||
soundEngine->AddRandomSound(Owner, list);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_MusicVolume: {
|
||||
sc.MustGetString();
|
||||
FName musname (sc.String);
|
||||
|
|
|
@ -1528,10 +1528,8 @@ void think_d(void)
|
|||
doanimations();
|
||||
tickstat(STAT_FX); //ST 11
|
||||
|
||||
#if 0 // still needs a bit of work.
|
||||
if (numplayers < 2 && thunderon)
|
||||
thunder();
|
||||
#endif
|
||||
|
||||
thinktime.Unclock();
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ void thunder(void)
|
|||
{
|
||||
thunderflash = 1;
|
||||
thundertime = 256;
|
||||
S_PlaySound(351 + (rand() % 3));
|
||||
S_PlaySound(soundEngine->FindSound("THUNDER"));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -477,7 +477,7 @@ void thunder(void)
|
|||
thunder_brightness = brightness;
|
||||
}
|
||||
}
|
||||
if (!winderflash && isRR())
|
||||
if (!winderflash)
|
||||
{
|
||||
bool seen = false;
|
||||
for (i = 0; i < lightnincnt; i++)
|
||||
|
@ -496,7 +496,7 @@ void thunder(void)
|
|||
{
|
||||
winderflash = 1;
|
||||
windertime = 128;
|
||||
S_PlaySound(351 + (rand() % 3));
|
||||
S_PlaySound(soundEngine->FindSound("THUNDER"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,6 +359,7 @@ $conreserve LN_SCREW 350
|
|||
$conreserve THUNDER1 351
|
||||
$conreserve THUNDER2 352
|
||||
$conreserve THUNDER3 353
|
||||
$random THUNDER { THUNDER1 THUNDER2, THUNDER3 }
|
||||
$conreserve BOWLSTRT 354
|
||||
$conreserve BOWLPIN 355
|
||||
$conreserve BOWLLOOP 356
|
||||
|
|
Loading…
Reference in a new issue