mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- Added translucent blending modes to FMultipatchTexture (not tested yet!)
- Also changed all true color texture creation functions to use proper alpha values instead of inverted ones. - Changed FRemapTable so that all palette entries must contain proper alpha values. - Fixed: The F1 screen check in m_menu.cpp was missing a NULL pointer check. - Changed: The boss brain's explosions play weapons/rocklx which is an unlimited sound. This can become extremely loud. Replaced with a new sound which is just an alias to weapons/rocklx but has a limit of 4. SVN r932 (trunk)
This commit is contained in:
parent
2a7ff45829
commit
4667bfe46f
20 changed files with 351 additions and 158 deletions
|
@ -1,3 +1,18 @@
|
|||
April 22, 2008 (Changes by Graf Zahl)
|
||||
- Added translucent blending modes to FMultipatchTexture (not tested yet!)
|
||||
- Also changed all true color texture creation functions to use proper alpha
|
||||
values instead of inverted ones.
|
||||
- Changed FRemapTable so that all palette entries must contain proper alpha
|
||||
values.
|
||||
|
||||
April 21, 2008 (Changes by Graf Zahl)
|
||||
- Fixed: The F1 screen check in m_menu.cpp was missing a NULL pointer check.
|
||||
|
||||
April 20, 2008 (Changes by Graf Zahl)
|
||||
- Changed: The boss brain's explosions play weapons/rocklx which is an
|
||||
unlimited sound. This can become extremely loud. Replaced with a new
|
||||
sound which is just an alias to weapons/rocklx but has a limit of 4.
|
||||
|
||||
April 19, 2008
|
||||
- Fixed: MugShotFrame::getTexture() allocated space for the sprite name that
|
||||
it never freed. I'm not sure it's a good assumption that 9 characters is
|
||||
|
|
|
@ -187,6 +187,7 @@ static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
|
|||
AActor *boom = Spawn("Rocket", x, y, z, NO_REPLACE);
|
||||
if (boom != NULL)
|
||||
{
|
||||
boom->DeathSound = S_FindSound("misc/brainexplode");
|
||||
boom->momz = pr_brainscream() << 9;
|
||||
boom->SetState (&ABossBrain::States[S_BRAINEXPLODE]);
|
||||
boom->effects = 0;
|
||||
|
|
|
@ -1464,7 +1464,7 @@ void M_DrawReadThis ()
|
|||
else
|
||||
{
|
||||
// Did the mapper choose a custom help page via MAPINFO?
|
||||
if (level.info->f1[0] != 0)
|
||||
if ((level.info != NULL) && level.info->f1[0] != 0)
|
||||
{
|
||||
tex = TexMan.FindTexture(level.info->f1);
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ void M_Init (void)
|
|||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
FireRemap.Remap[i] = ColorMatcher.Pick (i/2+32, 0, i/4);
|
||||
FireRemap.Palette[i] = PalEntry(i/2+32, 0, i/4);
|
||||
FireRemap.Palette[i] = PalEntry(255, i/2+32, 0, i/4);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3522,7 +3522,7 @@ void M_Init (void)
|
|||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
FireRemap.Remap[i] = ColorMatcher.Pick (i/4, i*13/40+7, i/4);
|
||||
FireRemap.Palette[i] = PalEntry(i/4, i*13/40+7, i/4);
|
||||
FireRemap.Palette[i] = PalEntry(255, i/4, i*13/40+7, i/4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,16 +107,19 @@ protected:
|
|||
SWORD OriginX, OriginY;
|
||||
BYTE Rotate;
|
||||
bool textureOwned;
|
||||
BYTE op;
|
||||
FRemapTable *Translation;
|
||||
PalEntry Blend;
|
||||
FTexture *Texture;
|
||||
fixed_t Alpha;
|
||||
|
||||
TexPart();
|
||||
};
|
||||
|
||||
int NumParts;
|
||||
TexPart *Parts;
|
||||
bool bRedirect;
|
||||
bool bRedirect:1;
|
||||
bool bTranslucentPatches:1;
|
||||
|
||||
void MakeTexture ();
|
||||
|
||||
|
|
|
@ -797,7 +797,7 @@ public:
|
|||
virtual const BYTE *GetPixels () = 0;
|
||||
|
||||
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
|
||||
int CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap);
|
||||
int CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap, FCopyInfo *inf = NULL);
|
||||
virtual bool UseBasePalette();
|
||||
virtual int GetSourceLump() { return -1; }
|
||||
|
||||
|
|
|
@ -160,9 +160,7 @@ void FRemapTable::Serialize(FArchive &arc)
|
|||
}
|
||||
for (int j = 0; j < NumEntries; ++j)
|
||||
{
|
||||
arc << Palette[j].r
|
||||
<< Palette[j].g
|
||||
<< Palette[j].b;
|
||||
arc << Palette[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,6 +177,10 @@ void FRemapTable::MakeIdentity()
|
|||
{
|
||||
Palette[i] = GPalette.BaseColors[i];
|
||||
}
|
||||
for (i = 1; i < NumEntries; ++i)
|
||||
{
|
||||
Palette[i].a = 255;
|
||||
}
|
||||
}
|
||||
|
||||
bool FRemapTable::IsIdentity() const
|
||||
|
@ -232,6 +234,7 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
|
|||
{
|
||||
Remap[start] = pal1;
|
||||
Palette[start] = GPalette.BaseColors[pal1];
|
||||
Palette[start].a = start==0? 0:255;
|
||||
return;
|
||||
}
|
||||
palcol = pal1 << FRACBITS;
|
||||
|
@ -240,6 +243,7 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
|
|||
{
|
||||
Remap[i] = palcol >> FRACBITS;
|
||||
Palette[i] = GPalette.BaseColors[palcol >> FRACBITS];
|
||||
Palette[i].a = i==0? 0:255;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,6 +282,7 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
|
|||
Remap[start] = ColorMatcher.Pick
|
||||
(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
Palette[start] = PalEntry(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
Palette[start].a = start==0? 0:255;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -288,7 +293,7 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
|
|||
{
|
||||
Remap[i] = ColorMatcher.Pick
|
||||
(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
Palette[i] = PalEntry(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
Palette[i] = PalEntry(start==0? 0:255, r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
r += rs;
|
||||
g += gs;
|
||||
b += bs;
|
||||
|
|
|
@ -233,7 +233,7 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in
|
|||
|
||||
typedef void (*CopyFunc)(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *inf);
|
||||
|
||||
static CopyFunc copyfuncs[9]=
|
||||
static const CopyFunc copyfuncs[][9]={
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bCopy>,
|
||||
iCopyColors<cRGBA, cBGRA, bCopy>,
|
||||
|
@ -244,7 +244,74 @@ static CopyFunc copyfuncs[9]=
|
|||
iCopyColors<cI16, cBGRA, bCopy>,
|
||||
iCopyColors<cRGB555, cBGRA, bCopy>,
|
||||
iCopyColors<cPalEntry, cBGRA, bCopy>
|
||||
};
|
||||
},
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bBlend>,
|
||||
iCopyColors<cRGBA, cBGRA, bBlend>,
|
||||
iCopyColors<cIA, cBGRA, bBlend>,
|
||||
iCopyColors<cCMYK, cBGRA, bBlend>,
|
||||
iCopyColors<cBGR, cBGRA, bBlend>,
|
||||
iCopyColors<cBGRA, cBGRA, bBlend>,
|
||||
iCopyColors<cI16, cBGRA, bBlend>,
|
||||
iCopyColors<cRGB555, cBGRA, bBlend>,
|
||||
iCopyColors<cPalEntry, cBGRA, bBlend>
|
||||
},
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bAdd>,
|
||||
iCopyColors<cRGBA, cBGRA, bAdd>,
|
||||
iCopyColors<cIA, cBGRA, bAdd>,
|
||||
iCopyColors<cCMYK, cBGRA, bAdd>,
|
||||
iCopyColors<cBGR, cBGRA, bAdd>,
|
||||
iCopyColors<cBGRA, cBGRA, bAdd>,
|
||||
iCopyColors<cI16, cBGRA, bAdd>,
|
||||
iCopyColors<cRGB555, cBGRA, bAdd>,
|
||||
iCopyColors<cPalEntry, cBGRA, bAdd>
|
||||
},
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bSubtract>,
|
||||
iCopyColors<cRGBA, cBGRA, bSubtract>,
|
||||
iCopyColors<cIA, cBGRA, bSubtract>,
|
||||
iCopyColors<cCMYK, cBGRA, bSubtract>,
|
||||
iCopyColors<cBGR, cBGRA, bSubtract>,
|
||||
iCopyColors<cBGRA, cBGRA, bSubtract>,
|
||||
iCopyColors<cI16, cBGRA, bSubtract>,
|
||||
iCopyColors<cRGB555, cBGRA, bSubtract>,
|
||||
iCopyColors<cPalEntry, cBGRA, bSubtract>
|
||||
},
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cRGBA, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cIA, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cCMYK, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cBGR, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cBGRA, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cI16, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cRGB555, cBGRA, bReverseSubtract>,
|
||||
iCopyColors<cPalEntry, cBGRA, bReverseSubtract>
|
||||
},
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bModulate>,
|
||||
iCopyColors<cRGBA, cBGRA, bModulate>,
|
||||
iCopyColors<cIA, cBGRA, bModulate>,
|
||||
iCopyColors<cCMYK, cBGRA, bModulate>,
|
||||
iCopyColors<cBGR, cBGRA, bModulate>,
|
||||
iCopyColors<cBGRA, cBGRA, bModulate>,
|
||||
iCopyColors<cI16, cBGRA, bModulate>,
|
||||
iCopyColors<cRGB555, cBGRA, bModulate>,
|
||||
iCopyColors<cPalEntry, cBGRA, bModulate>
|
||||
},
|
||||
{
|
||||
iCopyColors<cRGB, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cRGBA, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cIA, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cCMYK, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cBGR, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cBGRA, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cI16, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cRGB555, cBGRA, bCopyAlpha>,
|
||||
iCopyColors<cPalEntry, cBGRA, bCopyAlpha>
|
||||
},
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -373,13 +440,55 @@ void FBitmap::CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int
|
|||
if (ClipCopyPixelRect(Width, Height, originx, originy, patch, srcwidth, srcheight, step_x, step_y, rotate))
|
||||
{
|
||||
BYTE *buffer = data + 4 * originx + Pitch * originy;
|
||||
int op = inf==NULL? OP_COPY : inf->op;
|
||||
for (int y=0;y<srcheight;y++)
|
||||
{
|
||||
copyfuncs[ct](&buffer[y*Pitch], &patch[y*step_y], srcwidth, step_x, inf);
|
||||
copyfuncs[op][ct](&buffer[y*Pitch], &patch[y*step_y], srcwidth, step_x, inf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class TDest, class TBlend>
|
||||
void iCopyPaletted(BYTE *buffer, const BYTE * patch, int srcwidth, int srcheight, int Pitch,
|
||||
int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf)
|
||||
{
|
||||
int x,y,pos;
|
||||
|
||||
for (y=0;y<srcheight;y++)
|
||||
{
|
||||
pos = y*Pitch;
|
||||
for (x=0;x<srcwidth;x++,pos+=4)
|
||||
{
|
||||
int v=(unsigned char)patch[y*step_y+x*step_x];
|
||||
int a;
|
||||
|
||||
if ((a = palette[v].a))
|
||||
{
|
||||
TBlend::OpC(buffer[pos + TDest::RED], palette[v].r, a, inf);
|
||||
TBlend::OpC(buffer[pos + TDest::GREEN], palette[v].g, a, inf);
|
||||
TBlend::OpC(buffer[pos + TDest::BLUE], palette[v].b, a, inf);
|
||||
TBlend::OpA(buffer[pos + TDest::ALPHA], a, inf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*CopyPalettedFunc)(BYTE *buffer, const BYTE * patch, int srcwidth, int srcheight, int Pitch,
|
||||
int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf);
|
||||
|
||||
|
||||
static const CopyPalettedFunc copypalettedfuncs[]=
|
||||
{
|
||||
iCopyPaletted<cBGRA, bCopy>,
|
||||
iCopyPaletted<cBGRA, bBlend>,
|
||||
iCopyPaletted<cBGRA, bAdd>,
|
||||
iCopyPaletted<cBGRA, bSubtract>,
|
||||
iCopyPaletted<cBGRA, bReverseSubtract>,
|
||||
iCopyPaletted<cBGRA, bModulate>,
|
||||
iCopyPaletted<cBGRA, bCopyAlpha>,
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Paletted to True Color texture copy function
|
||||
|
@ -388,8 +497,6 @@ void FBitmap::CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int
|
|||
void FBitmap::CopyPixelData(int originx, int originy, const BYTE * patch, int srcwidth, int srcheight,
|
||||
int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf)
|
||||
{
|
||||
int x,y,pos;
|
||||
|
||||
if (ClipCopyPixelRect(Width, Height, originx, originy, patch, srcwidth, srcheight, step_x, step_y, rotate))
|
||||
{
|
||||
BYTE *buffer = data + 4*originx + Pitch*originy;
|
||||
|
@ -397,39 +504,12 @@ void FBitmap::CopyPixelData(int originx, int originy, const BYTE * patch, int sr
|
|||
|
||||
if (inf && inf->blend)
|
||||
{
|
||||
// The palette's alpha is inverted so in order to use the
|
||||
// True Color copy functions it has to be inverted temporarily.
|
||||
memcpy(penew, palette, 4*256);
|
||||
for(int i=0;i<256;i++) penew[i].a = 255-penew[i].a;
|
||||
copyfuncs[CF_PalEntry]((BYTE*)penew, (BYTE*)penew, 256, 4, inf);
|
||||
for(int i=0;i<256;i++) penew[i].a = 255-penew[i].a;
|
||||
iCopyColors<cPalEntry, cBGRA, bCopy>((BYTE*)penew, (const BYTE*)palette, 256, 4, inf);
|
||||
palette = penew;
|
||||
}
|
||||
|
||||
|
||||
for (y=0;y<srcheight;y++)
|
||||
{
|
||||
pos = y*Pitch;
|
||||
for (x=0;x<srcwidth;x++,pos+=4)
|
||||
{
|
||||
int v=(unsigned char)patch[y*step_y+x*step_x];
|
||||
if (palette[v].a==0)
|
||||
{
|
||||
buffer[pos]=palette[v].b;
|
||||
buffer[pos+1]=palette[v].g;
|
||||
buffer[pos+2]=palette[v].r;
|
||||
buffer[pos+3]=255;
|
||||
}
|
||||
else if (palette[v].a!=255)
|
||||
{
|
||||
// [RH] Err... This can't be right, can it?
|
||||
buffer[pos ] = (buffer[pos ] * palette[v].a + palette[v].b * (1-palette[v].a)) / 255;
|
||||
buffer[pos+1] = (buffer[pos+1] * palette[v].a + palette[v].g * (1-palette[v].a)) / 255;
|
||||
buffer[pos+2] = (buffer[pos+2] * palette[v].a + palette[v].r * (1-palette[v].a)) / 255;
|
||||
buffer[pos+3] = clamp<int>(buffer[pos+3] + (( 255-buffer[pos+3]) * (255-palette[v].a))/255, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
copypalettedfuncs[inf==NULL? OP_COPY : inf->op](buffer, patch, srcwidth, srcheight, Pitch,
|
||||
step_x, step_y, rotate, palette, inf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#define __BITMAP_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "templates.h"
|
||||
|
||||
struct FCopyInfo;
|
||||
|
||||
|
@ -272,14 +273,24 @@ enum EBlend
|
|||
BLEND_OVERLAY = -2,
|
||||
};
|
||||
|
||||
enum ECopyOp
|
||||
{
|
||||
OP_COPY,
|
||||
OP_BLEND,
|
||||
OP_ADD,
|
||||
OP_SUBTRACT,
|
||||
OP_REVERSESUBTRACT,
|
||||
OP_MODULATE,
|
||||
OP_COPYALPHA
|
||||
};
|
||||
|
||||
struct FCopyInfo
|
||||
{
|
||||
//ECopyOp op;
|
||||
ECopyOp op;
|
||||
EBlend blend;
|
||||
fixed_t blendcolor[4];
|
||||
// fixed_t alpha;
|
||||
// fixed_t invalpha;
|
||||
|
||||
fixed_t alpha;
|
||||
fixed_t invalpha;
|
||||
};
|
||||
|
||||
struct bCopy
|
||||
|
@ -288,6 +299,41 @@ struct bCopy
|
|||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
struct bBlend
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (d*i->invalpha + s*i->alpha) >> FRACBITS; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
struct bAdd
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MIN<int>((d*FRACUNIT + s*i->alpha) >> FRACBITS, 255); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
struct bSubtract
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX<int>((d*FRACUNIT - s*i->alpha) >> FRACBITS, 0); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
struct bReverseSubtract
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX<int>((-d*FRACUNIT + s*i->alpha) >> FRACBITS, 0); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
struct bModulate
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*d)/255; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
struct bCopyAlpha
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ int FJPEGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FC
|
|||
break;
|
||||
|
||||
case JCS_GRAYSCALE:
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // default to a gray map
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // default to a gray map
|
||||
bmp->CopyPixelData(x, y, buff, cinfo.output_width, cinfo.output_height,
|
||||
1, cinfo.output_width, rotate, pe, inf);
|
||||
break;
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
//==========================================================================
|
||||
|
||||
FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchlookup, int maxpatchnum, bool strife, int deflumpnum)
|
||||
: Pixels (0), Spans(0), Parts(0), bRedirect(false)
|
||||
: Pixels (0), Spans(0), Parts(0), bRedirect(false), bTranslucentPatches(false)
|
||||
{
|
||||
union
|
||||
{
|
||||
|
@ -361,15 +361,38 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
Pixels = new BYTE[numpix];
|
||||
memset (Pixels, 0, numpix);
|
||||
|
||||
for (int i = 0; i < NumParts; ++i)
|
||||
if (!bTranslucentPatches)
|
||||
{
|
||||
BYTE *trans = Parts[i].Translation? Parts[i].Translation->Remap : NULL;
|
||||
if (Parts[i].Blend != BLEND_NONE)
|
||||
for (int i = 0; i < NumParts; ++i)
|
||||
{
|
||||
trans = GetBlendMap(Parts[i].Blend, blendwork);
|
||||
BYTE *trans = Parts[i].Translation? Parts[i].Translation->Remap : NULL;
|
||||
if (Parts[i].Blend != BLEND_NONE)
|
||||
{
|
||||
trans = GetBlendMap(Parts[i].Blend, blendwork);
|
||||
}
|
||||
Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
|
||||
Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans);
|
||||
}
|
||||
Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
|
||||
Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans);
|
||||
}
|
||||
else
|
||||
{
|
||||
// In case there are translucent patches let's do the composition in
|
||||
// True color to keep as much precision as possible before downconverting to the palette.
|
||||
BYTE *buffer = new BYTE[Width * Height * 4];
|
||||
FillBuffer(buffer, Width * 4, Height, TEX_RGB);
|
||||
for(int y = 0; y < Height; y++)
|
||||
{
|
||||
BYTE *in = buffer + Width * y * 4;
|
||||
BYTE *out = Pixels + y;
|
||||
for (int x = 0; x < Width; x--)
|
||||
{
|
||||
// I don't know if this is precise enough...
|
||||
*out = RGB32k[in[2]>>3][in[1]>>3][in[0]>>3];
|
||||
out += Height;
|
||||
in += 4;
|
||||
}
|
||||
}
|
||||
delete [] buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,10 +416,13 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota
|
|||
if (!Parts[i].Texture->bComplex || inf == NULL)
|
||||
{
|
||||
memset (&info, 0, sizeof (info));
|
||||
info.alpha = Parts[i].Alpha;
|
||||
info.invalpha = FRACUNIT - info.alpha;
|
||||
info.op = ECopyOp(Parts[i].op);
|
||||
if (Parts[i].Translation != NULL)
|
||||
{
|
||||
// Using a translation forces downconversion to the base palette
|
||||
ret = Parts[i].Texture->CopyTrueColorTranslated(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, Parts[i].Translation);
|
||||
ret = Parts[i].Texture->CopyTrueColorTranslated(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, Parts[i].Translation, &info);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -626,6 +652,8 @@ FMultiPatchTexture::TexPart::TexPart()
|
|||
Texture = NULL;
|
||||
Translation = NULL;
|
||||
Blend = 0;
|
||||
Alpha = FRACUNIT;
|
||||
op = OP_COPY;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -980,6 +1008,19 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
else part.Blend.a = 255;
|
||||
bComplex = true;
|
||||
}
|
||||
else if (sc.Compare("alpha"))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
part.Alpha = clamp(FLOAT2FIXED(sc.Float), 0, FRACUNIT);
|
||||
// bComplex is not set because it is only needed when the style is not OP_COPY.
|
||||
}
|
||||
else if (sc.Compare("style"))
|
||||
{
|
||||
static const char *styles[] = {"copy", "blend", "add", "subtract", "reversesubtract", "modulate", "copyalpha", NULL };
|
||||
sc.MustGetString();
|
||||
part.op = sc.MustMatchString(styles);
|
||||
bTranslucentPatches = bComplex = (part.op != OP_COPY);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Mirror & 2)
|
||||
|
@ -995,7 +1036,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
|
||||
|
||||
FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
|
||||
: Pixels (0), Spans(0), Parts(0), bRedirect(false)
|
||||
: Pixels (0), Spans(0), Parts(0), bRedirect(false), bTranslucentPatches(false)
|
||||
{
|
||||
TArray<TexPart> parts;
|
||||
|
||||
|
|
|
@ -462,13 +462,13 @@ int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
c=0x0c; // Apparently there's many non-compliant PCXs out there...
|
||||
if (c !=0x0c)
|
||||
{
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // default to a gray map
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // default to a gray map
|
||||
}
|
||||
else for(int i=0;i<256;i++)
|
||||
{
|
||||
BYTE r,g,b;
|
||||
lump >> r >> g >> b;
|
||||
pe[i] = PalEntry(r,g,b);
|
||||
pe[i] = PalEntry(255, r,g,b);
|
||||
}
|
||||
lump.Seek(sizeof(header), SEEK_SET);
|
||||
ReadPCX8bits (Pixels, lump, &header);
|
||||
|
|
|
@ -511,7 +511,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
}
|
||||
|
||||
lump->Seek (33, SEEK_SET);
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // default to a gray map
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // default to a gray map
|
||||
|
||||
(*lump) >> len >> id;
|
||||
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
||||
|
@ -534,7 +534,6 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
for(DWORD i=0;i<len;i++)
|
||||
{
|
||||
(*lump) >> pe[i].a;
|
||||
pe[i].a=255-pe[i].a; // use inverse alpha so the default palette can be used unchanged
|
||||
if (pe[i].a!=0 && pe[i].a!=255) transpal = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -483,20 +483,16 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt)
|
|||
int FTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry *palette = screen->GetPalette();
|
||||
palette[0].a=255; // temporarily modify the first color's alpha
|
||||
for(int i=1;i<256;i++) palette[i].a = 255; // set proper alpha values
|
||||
bmp->CopyPixelData(x, y, GetPixels(), Width, Height, Height, 1, rotate, palette, inf);
|
||||
|
||||
palette[0].a=0;
|
||||
for(int i=1;i<256;i++) palette[i].a = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FTexture::CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap)
|
||||
int FTexture::CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry *palette = remap->Palette;
|
||||
palette[0].a=255; // temporarily modify the first color's alpha
|
||||
bmp->CopyPixelData(x, y, GetPixels(), Width, Height, Height, 1, rotate, palette);
|
||||
|
||||
palette[0].a=0;
|
||||
bmp->CopyPixelData(x, y, GetPixels(), Width, Height, Height, 1, rotate, palette, inf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -436,7 +436,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
r=g=b=a=0;
|
||||
break;
|
||||
}
|
||||
pe[i] = PalEntry(255-a, r, g, b);
|
||||
pe[i] = PalEntry(a, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
switch (hdr.bpp)
|
||||
{
|
||||
case 8:
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // gray map
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // gray map
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1283,11 +1283,11 @@ static void ActorStates (FScanner &sc, AActor *defaults, Baggage &bag)
|
|||
static void ActorRenderStyle (FScanner &sc, AActor *defaults, Baggage &bag)
|
||||
{
|
||||
static const char * renderstyles[]={
|
||||
"NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD",NULL};
|
||||
"NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD","SHADED", NULL};
|
||||
|
||||
static const int renderstyle_values[]={
|
||||
STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
|
||||
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add};
|
||||
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded};
|
||||
|
||||
sc.MustGetString();
|
||||
defaults->RenderStyle = LegacyRenderStyles[renderstyle_values[sc.MustMatchString(renderstyles)]];
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
// SAVESIG should match SAVEVER.
|
||||
|
||||
// MINSAVEVER is the minimum level snapshot version that can be loaded.
|
||||
#define MINSAVEVER 922
|
||||
#define MINSAVEVER 932
|
||||
|
||||
#if SVN_REVISION_NUMBER < MINSAVEVER
|
||||
// Never write a savegame with a version lower than what we need
|
||||
|
|
|
@ -2086,13 +2086,13 @@ bool D3DPal::Update()
|
|||
|
||||
for (i = 0; i < skipat; ++i)
|
||||
{
|
||||
buff[i] = D3DCOLOR_ARGB(i == 0 ? 0 : 255, pal[i].r, pal[i].g, pal[i].b);
|
||||
buff[i] = D3DCOLOR_ARGB(pal[i].a, pal[i].r, pal[i].g, pal[i].b);
|
||||
}
|
||||
for (++i; i < Remap->NumEntries; ++i)
|
||||
{
|
||||
buff[i] = D3DCOLOR_ARGB(255, pal[i-1].r, pal[i-1].g, pal[i-1].b);
|
||||
buff[i] = D3DCOLOR_ARGB(pal[i].a, pal[i-1].r, pal[i-1].g, pal[i-1].b);
|
||||
}
|
||||
BorderColor = D3DCOLOR_ARGB(255, pal[i-1].r, pal[i-1].g, pal[i-1].b);
|
||||
BorderColor = D3DCOLOR_ARGB(pal[i].a, pal[i-1].r, pal[i-1].g, pal[i-1].b);
|
||||
|
||||
Tex->UnlockRect(0);
|
||||
return true;
|
||||
|
|
|
@ -746,7 +746,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
|
||||
}
|
||||
SetSoundPaused (wParam);
|
||||
//SetSoundPaused (wParam);
|
||||
break;
|
||||
|
||||
case WM_WTSSESSION_CHANGE:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="updaterevision"
|
||||
ProjectGUID="{6077B7D6-349F-4077-B552-3BC302EF5859}"
|
||||
RootNamespace="updaterevision"
|
||||
|
@ -95,82 +95,6 @@
|
|||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
|
@ -248,6 +172,82 @@
|
|||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
|
@ -348,7 +348,7 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
@ -356,7 +356,7 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
|
|
@ -202,6 +202,13 @@ weapons/bfgf dsbfg
|
|||
weapons/bfgx dsrxplod
|
||||
weapons/railgf railgf1
|
||||
|
||||
// Problem: weapons/rocklx needs to be unlimited but
|
||||
// is also used for the MAP30 brain explosion.
|
||||
// This alias remaps to the original but has its own limit
|
||||
// attached so that it doesn't become too loud.
|
||||
$alias misc/brainexplode weapons/rocklx
|
||||
$limit misc/brainexplode 4
|
||||
|
||||
$limit weapons/plasmaf 0
|
||||
$limit weapons/chngun 0
|
||||
$limit weapons/rocklf 0 // because normal running is almost as fast as a rocket
|
||||
|
|
Loading…
Reference in a new issue