* Updated to ZDoom 4289:

- Added parentheses for clarity.
- Fixed potential uninitialized access in FMapInfoParser::ParseEndGame().
- Fixed: 4, 2, and 1 bit grayscale images weren't properly supported.
- Fixed: Valgrind uninitialized memory error and a signed/unsigned warning.
- Just remembered that the true color stuff generates textures differently.  Changed the previous commit to expand 1, 2, and 4 bit grayscale images while reading the PNG instead of changing the palette.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1576 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2013-05-26 11:33:33 +00:00
parent 7336b490c0
commit 87761b3383
5 changed files with 48 additions and 17 deletions

View file

@ -660,7 +660,7 @@ FName FMapInfoParser::ParseEndGame()
}
}
FIntermissionDescriptor *desc = new FIntermissionDescriptor;
FIntermissionAction *action;
FIntermissionAction *action = NULL;
switch (newSeq.EndType)
{
@ -699,15 +699,23 @@ FName FMapInfoParser::ParseEndGame()
break;
}
action->mBackground = newSeq.PicName;
action->mMusic = newSeq.Music;
action->mMusicLooping = newSeq.MusicLooping;
desc->mActions.Push(action);
if (action == NULL)
{
sc.ScriptError("Endgame type was not defined");
return NAME_None; // We won't really get here.
}
else
{
action->mBackground = newSeq.PicName;
action->mMusic = newSeq.Music;
action->mMusicLooping = newSeq.MusicLooping;
desc->mActions.Push(action);
FString seq;
seq.Format("@EndSequence_%d_", generated++);
ReplaceIntermission(seq, desc);
return FName(seq);
FString seq;
seq.Format("@EndSequence_%d_", generated++);
ReplaceIntermission(seq, desc);
return FName(seq);
}
}
//==========================================================================

View file

@ -103,7 +103,7 @@ static inline void MakeChunk (void *where, DWORD type, size_t len);
static inline void StuffPalette (const PalEntry *from, BYTE *to);
static bool WriteIDAT (FILE *file, const BYTE *data, int len);
static void UnfilterRow (int width, BYTE *dest, BYTE *stream, BYTE *prev, int bpp);
static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *rowin, BYTE *rowout);
static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *rowin, BYTE *rowout, bool grayscale);
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
@ -604,7 +604,7 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc
in = prev;
if (bitdepth < 8)
{
UnpackPixels (passwidth, bytesPerRowIn, bitdepth, in, adam7buff[2]);
UnpackPixels (passwidth, bytesPerRowIn, bitdepth, in, adam7buff[2], colortype == 0);
in = adam7buff[2];
}
// Distribute pixels into the output buffer
@ -688,7 +688,7 @@ bool M_ReadIDAT (FileReader *file, BYTE *buffer, int width, int height, int pitc
passpitch = pitch << interlace;
for (curr = buffer + pitch * interlace; curr <= prev; curr += passpitch)
{
UnpackPixels (width, bytesPerRowIn, bitdepth, curr, curr);
UnpackPixels (width, bytesPerRowIn, bitdepth, curr, curr, colortype == 0);
}
}
return true;
@ -1155,7 +1155,7 @@ void UnfilterRow (int width, BYTE *dest, BYTE *row, BYTE *prev, int bpp)
//
//==========================================================================
static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *rowin, BYTE *rowout)
static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *rowin, BYTE *rowout, bool grayscale)
{
const BYTE *in;
BYTE *out;
@ -1242,4 +1242,26 @@ static void UnpackPixels (int width, int bytesPerRow, int bitdepth, const BYTE *
}
break;
}
// Expand gray scale to 8bpp
if(grayscale)
{
out = rowout + width;
while(--out >= rowout)
{
switch(bitdepth)
{
case 1:
*out *= 0xFF;
break;
case 2:
*out |= (*out<<2)|(*out<<4)|(*out<<6);
break;
case 4:
*out |= (*out<<4);
break;
default: break;
}
}
}
}

View file

@ -911,7 +911,7 @@ bool AActor::IsVisibleToPlayer() const
return true;
if (VisibleToTeam != 0 && teamplay &&
VisibleToTeam-1 != players[consoleplayer].userinfo.GetTeam())
(signed)(VisibleToTeam-1) != players[consoleplayer].userinfo.GetTeam())
return false;
const player_t* pPlayer = players[consoleplayer].camera->player;

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "4285"
#define ZD_SVN_REVISION_NUMBER 4285
#define ZD_SVN_REVISION_STRING "4289"
#define ZD_SVN_REVISION_NUMBER 4289

View file

@ -295,7 +295,7 @@ static int stripaccent(int code)
return 'D' + (code & 0x20);
if (acode == 0xD1) // N with tilde
return 'N' + (code & 0x20);
if (acode >= 0xD2 && acode <= 0xD6 || // O with accents
if ((acode >= 0xD2 && acode <= 0xD6) || // O with accents
acode == 0xD8) // O with stroke
return 'O' + (code & 0x20);
if (acode >= 0xD9 && acode <= 0xDC) // U with accents
@ -645,6 +645,7 @@ int FFont::SimpleTranslation (BYTE *colorsused, BYTE *translation, BYTE *reverse
qsort (reverse+1, j-1, 1, compare);
*luminosity = new double[j];
(*luminosity)[0] = 0.0; // [BL] Prevent uninitalized memory
max = 0.0;
min = 100000000.0;
for (i = 1; i < j; i++)