mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 06:41:41 +00:00
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
from DMX sounds. SVN r1792 (trunk)
This commit is contained in:
parent
45dde7aa2f
commit
6214177f1f
6 changed files with 48 additions and 30 deletions
|
@ -1,6 +1,13 @@
|
|||
September 5, 2009 (Changes by Graf Zahl)
|
||||
September 5, 2009 (Changes by Graf Zahl)
|
||||
- made menu dimming a mapping option but kept the CVARS as user override.
|
||||
|
||||
September 4, 2009
|
||||
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
|
||||
from DMX sounds.
|
||||
- Fixed: PNGTexture must not use the FArchive >> operator as a short hand
|
||||
for reading 4-byte integers, because that operator works with little
|
||||
endian numbers--a no-op on Intel processors, but bad joojoo on PowerPCs.
|
||||
|
||||
September 3, 2009 (Changes by Graf Zahl)
|
||||
- fixed: Weapons must first check if they can be switched and afterwards
|
||||
if they can be fired. These checks were reversed.
|
||||
|
|
|
@ -1255,7 +1255,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
|
|||
FWadLump wlump = Wads.OpenLumpNum(sfx->lumpnum);
|
||||
sfxstart = sfxdata = new BYTE[size];
|
||||
wlump.Read(sfxdata, size);
|
||||
SDWORD len = ((SDWORD *)sfxdata)[1];
|
||||
SDWORD len = LittleLong(((SDWORD *)sfxdata)[1]);
|
||||
|
||||
// If the sound is raw, just load it as such.
|
||||
// Otherwise, try the sound as DMX format.
|
||||
|
@ -1272,7 +1272,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
|
|||
}
|
||||
else
|
||||
{
|
||||
frequency = ((WORD *)sfxdata)[1];
|
||||
frequency = LittleShort(((WORD *)sfxdata)[1]);
|
||||
if (frequency == 0)
|
||||
{
|
||||
frequency = 11025;
|
||||
|
|
|
@ -131,7 +131,7 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in
|
|||
break;
|
||||
|
||||
case BLEND_GREENMAP:
|
||||
// Skulltags's Guardsphere map
|
||||
// Skulltag's Guardsphere map
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
a = TSrc::A(pin);
|
||||
|
|
|
@ -115,8 +115,9 @@ FTexture *PNGTexture_TryCreate(FileReader & data, int lumpnum)
|
|||
|
||||
// The PNG looks valid so far. Check the IHDR to make sure it's a
|
||||
// type of PNG we support.
|
||||
data >> width >> height
|
||||
>> bitdepth >> colortype >> compression >> filter >> interlace;
|
||||
data.Read(&width, 4);
|
||||
data.Read(&height, 4);
|
||||
data >> bitdepth >> colortype >> compression >> filter >> interlace;
|
||||
|
||||
if (compression != 0 || filter != 0 || interlace > 1)
|
||||
{
|
||||
|
@ -164,8 +165,9 @@ FTexture *PNGTexture_CreateFromFile(PNGHandle *png, const FString &filename)
|
|||
}
|
||||
|
||||
// Check the IHDR to make sure it's a type of PNG we support.
|
||||
(*png->File) >> width >> height
|
||||
>> bitdepth >> colortype >> compression >> filter >> interlace;
|
||||
png->File->Read(&width, 4);
|
||||
png->File->Read(&height, 4);
|
||||
(*png->File) >> bitdepth >> colortype >> compression >> filter >> interlace;
|
||||
|
||||
if (compression != 0 || filter != 0 || interlace > 1)
|
||||
{
|
||||
|
@ -220,7 +222,8 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
|||
// Parse pre-IDAT chunks. I skip the CRCs. Is that bad?
|
||||
lump.Seek(33, SEEK_SET);
|
||||
|
||||
lump >> len >> id;
|
||||
lump.Read(&len, 4);
|
||||
lump.Read(&id, 4);
|
||||
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
||||
{
|
||||
len = BigLong((unsigned int)len);
|
||||
|
@ -236,7 +239,8 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
|||
DWORD hotx, hoty;
|
||||
int ihotx, ihoty;
|
||||
|
||||
lump >> hotx >> hoty;
|
||||
lump.Read(&hotx, 4);
|
||||
lump.Read(&hoty, 4);
|
||||
ihotx = BigLong((int)hotx);
|
||||
ihoty = BigLong((int)hoty);
|
||||
if (ihotx < -32768 || ihotx > 32767)
|
||||
|
@ -249,8 +253,8 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
|||
Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", Wads.GetLumpFullName (lumpnum), ihoty, ihoty);
|
||||
ihoty = 0;
|
||||
}
|
||||
LeftOffset = (int)ihotx;
|
||||
TopOffset = (int)ihoty;
|
||||
LeftOffset = ihotx;
|
||||
TopOffset = ihoty;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -277,9 +281,10 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
|||
bMasked = true;
|
||||
break;
|
||||
}
|
||||
lump >> len >> len; // Skip CRC
|
||||
lump.Seek(4, SEEK_CUR); // Skip CRC
|
||||
lump.Read(&len, 4);
|
||||
id = MAKE_ID('I','E','N','D');
|
||||
lump >> id;
|
||||
lump.Read(&id, 4);
|
||||
}
|
||||
StartOfIDAT = lump.Tell() - 8;
|
||||
|
||||
|
@ -460,7 +465,8 @@ void FPNGTexture::MakeTexture ()
|
|||
{
|
||||
DWORD len, id;
|
||||
lump->Seek (StartOfIDAT, SEEK_SET);
|
||||
(*lump) >> len >> id;
|
||||
lump->Read(&len, 4);
|
||||
lump->Read(&id, 4);
|
||||
|
||||
if (ColorType == 0 || ColorType == 3) /* Grayscale and paletted */
|
||||
{
|
||||
|
@ -600,9 +606,11 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
|
|||
}
|
||||
|
||||
lump->Seek(33, SEEK_SET);
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // default to a gray map
|
||||
for(int i = 0; i < 256; i++) // default to a gray map
|
||||
pe[i] = PalEntry(255,i,i,i);
|
||||
|
||||
(*lump) >> len >> id;
|
||||
lump->Read(&len, 4);
|
||||
lump->Read(&id, 4);
|
||||
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
||||
{
|
||||
len = BigLong((unsigned int)len);
|
||||
|
@ -623,19 +631,22 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
|
|||
for(DWORD i = 0; i < len; i++)
|
||||
{
|
||||
(*lump) >> pe[i].a;
|
||||
if (pe[i].a!=0 && pe[i].a!=255) transpal = true;
|
||||
if (pe[i].a != 0 && pe[i].a != 255)
|
||||
transpal = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
(*lump) >> len >> len; // Skip CRC
|
||||
lump->Seek(4, SEEK_CUR); // Skip CRC
|
||||
lump->Read(&len, 4);
|
||||
id = MAKE_ID('I','E','N','D');
|
||||
(*lump) >> id;
|
||||
lump->Read(&id, 4);
|
||||
}
|
||||
|
||||
BYTE * Pixels = new BYTE[pixwidth * Height];
|
||||
|
||||
lump->Seek (StartOfIDAT, SEEK_SET);
|
||||
(*lump) >> len >> id;
|
||||
lump->Read(&len, 4);
|
||||
lump->Read(&len, 4);
|
||||
M_ReadIDAT (lump, Pixels, Width, Height, pixwidth, BitDepth, ColorType, Interlace, BigLong((unsigned int)len));
|
||||
delete lump;
|
||||
|
||||
|
|
Loading…
Reference in a new issue