- Fixed: Blood sound effect namespacing was broken.

SVN r2220 (trunk)
This commit is contained in:
Randy Heit 2010-03-18 03:55:51 +00:00
parent 8b98a3510e
commit aedb646a52
2 changed files with 29 additions and 26 deletions

View file

@ -56,13 +56,15 @@ struct RFFInfo
struct RFFLump struct RFFLump
{ {
BYTE IDontKnow[16]; DWORD DontKnow1[4];
DWORD FilePos; DWORD FilePos;
DWORD Size; DWORD Size;
BYTE IStillDontKnow[8]; DWORD DontKnow2;
DWORD Time;
BYTE Flags; BYTE Flags;
char Extension[3]; char Extension[3];
char Name[8+4]; // 4 bytes that I don't know what they are for char Name[8];
DWORD IndexNum; // Used by .sfx, possibly others
}; };
//========================================================================== //==========================================================================
@ -75,6 +77,8 @@ struct FRFFLump : public FUncompressedLump
{ {
virtual FileReader *GetReader(); virtual FileReader *GetReader();
virtual int FillCache(); virtual int FillCache();
DWORD IndexNum;
}; };
//========================================================================== //==========================================================================
@ -149,20 +153,6 @@ bool FRFFFile::Open(bool quiet)
if (!quiet) Printf(", %d lumps\n", NumLumps); if (!quiet) Printf(", %d lumps\n", NumLumps);
for (DWORD i = 0; i < NumLumps; ++i) for (DWORD i = 0; i < NumLumps; ++i)
{ {
if (lumps[i].Extension[0] == 'S' && lumps[i].Extension[1] == 'F' &&
lumps[i].Extension[2] == 'X')
{
Lumps[i].Namespace = ns_bloodsfx;
}
else if (lumps[i].Extension[0] == 'R' && lumps[i].Extension[1] == 'A' &&
lumps[i].Extension[2] == 'W')
{
Lumps[i].Namespace = ns_bloodraw;
}
else
{
Lumps[i].Namespace = ns_global;
}
Lumps[i].Position = LittleLong(lumps[i].FilePos); Lumps[i].Position = LittleLong(lumps[i].FilePos);
Lumps[i].LumpSize = LittleLong(lumps[i].Size); Lumps[i].LumpSize = LittleLong(lumps[i].Size);
Lumps[i].Owner = this; Lumps[i].Owner = this;
@ -170,14 +160,27 @@ bool FRFFFile::Open(bool quiet)
{ {
Lumps[i].Flags |= LUMPF_BLOODCRYPT; Lumps[i].Flags |= LUMPF_BLOODCRYPT;
} }
// Rearrange the name and extension in a part of the lump record Lumps[i].IndexNum = LittleLong(lumps[i].IndexNum);
// that I don't have any use for in order to construct the fullname. // Rearrange the name and extension to construct the fullname.
lumps[i].Name[8] = '\0'; char name[13];
strcpy ((char *)lumps[i].IDontKnow, lumps[i].Name); strncpy(name, lumps[i].Name, 8);
strcat ((char *)lumps[i].IDontKnow, "."); name[8] = 0;
lumps[i].Name[0] = '\0'; size_t len = strlen(name);
strcat ((char *)lumps[i].IDontKnow, lumps[i].Extension); assert(len + 4 <= 12);
Lumps[i].LumpNameSetup((char *)lumps[i].IDontKnow); name[len+0] = '.';
name[len+1] = lumps[i].Extension[0];
name[len+2] = lumps[i].Extension[1];
name[len+3] = lumps[i].Extension[2];
name[len+4] = 0;
Lumps[i].LumpNameSetup(name);
if (name[len+1] == 'S' && name[len+2] == 'F' && name[len+3] == 'X')
{
Lumps[i].Namespace = ns_bloodsfx;
}
else if (name[len+1] == 'R' && name[len+2] == 'A' && name[len+3] == 'W')
{
Lumps[i].Namespace = ns_bloodraw;
}
} }
delete[] lumps; delete[] lumps;
return true; return true;

View file

@ -1977,7 +1977,7 @@ void AAmbientSound::Tick ()
if (ambient->sound[0]) if (ambient->sound[0])
{ {
// The second argumens scales the ambient sound's volume. // The second argument scales the ambient sound's volume.
// 0 and 128 are normal volume. The maximum volume level // 0 and 128 are normal volume. The maximum volume level
// possible is always 1. // possible is always 1.
float volscale = args[1] == 0 ? 1 : args[1] / 128.f; float volscale = args[1] == 0 ? 1 : args[1] / 128.f;