mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-24 21:01:35 +00:00
Merge branch 'floatcvt' of https://github.com/rheit/zdoom into floatcvt
# Conflicts: # src/win32/fb_d3d9.cpp
This commit is contained in:
commit
f568a35756
17 changed files with 118 additions and 113 deletions
|
@ -2070,7 +2070,7 @@ void AM_drawSubsectors()
|
|||
originx, originy,
|
||||
scale / (FIXED2DBL(scalex) * float(1 << MAPBITS)),
|
||||
scale / (FIXED2DBL(scaley) * float(1 << MAPBITS)),
|
||||
rotation,
|
||||
ANGLE2DBL(rotation),
|
||||
colormap,
|
||||
floorlight
|
||||
);
|
||||
|
|
|
@ -230,12 +230,12 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f
|
|||
FTexture * tex= TexMan(texnum);
|
||||
if (!tex) return false;
|
||||
|
||||
fixed_t totalscale = abs(FixedMul(side->GetTextureYScale(side_t::mid), tex->yScale));
|
||||
double totalscale = fabs(FIXED2DBL(side->GetTextureYScale(side_t::mid)) * tex->GetScaleY());
|
||||
fixed_t y_offset = side->GetTextureYOffset(side_t::mid);
|
||||
fixed_t textureheight = tex->GetScaledHeight(totalscale) << FRACBITS;
|
||||
if (totalscale != FRACUNIT && !tex->bWorldPanning)
|
||||
if (totalscale != 1. && !tex->bWorldPanning)
|
||||
{
|
||||
y_offset = FixedDiv(y_offset, totalscale);
|
||||
y_offset = fixed_t(y_offset * totalscale);
|
||||
}
|
||||
|
||||
if(line->flags & ML_DONTPEGBOTTOM)
|
||||
|
|
|
@ -310,7 +310,7 @@ FNativePalette *FRemapTable::GetNative()
|
|||
|
||||
void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
|
||||
{
|
||||
fixed_t palcol, palstep;
|
||||
double palcol, palstep;
|
||||
|
||||
if (start > end)
|
||||
{
|
||||
|
@ -326,11 +326,11 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
|
|||
Palette[start].a = start == 0 ? 0 : 255;
|
||||
return;
|
||||
}
|
||||
palcol = pal1 << FRACBITS;
|
||||
palstep = ((pal2 << FRACBITS) - palcol) / (end - start);
|
||||
palcol = pal1;
|
||||
palstep = (pal2 - palcol) / (end - start);
|
||||
for (int i = start; i <= end; palcol += palstep, ++i)
|
||||
{
|
||||
int j = GPalette.Remap[i], k = GPalette.Remap[palcol >> FRACBITS];
|
||||
int j = GPalette.Remap[i], k = GPalette.Remap[int(palcol)];
|
||||
Remap[j] = k;
|
||||
Palette[j] = GPalette.BaseColors[k];
|
||||
Palette[j].a = j == 0 ? 0 : 255;
|
||||
|
@ -345,14 +345,14 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
|
|||
|
||||
void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, int _r2, int _g2, int _b2)
|
||||
{
|
||||
fixed_t r1 = _r1 << FRACBITS;
|
||||
fixed_t g1 = _g1 << FRACBITS;
|
||||
fixed_t b1 = _b1 << FRACBITS;
|
||||
fixed_t r2 = _r2 << FRACBITS;
|
||||
fixed_t g2 = _g2 << FRACBITS;
|
||||
fixed_t b2 = _b2 << FRACBITS;
|
||||
fixed_t r, g, b;
|
||||
fixed_t rs, gs, bs;
|
||||
double r1 = _r1;
|
||||
double g1 = _g1;
|
||||
double b1 = _b1;
|
||||
double r2 = _r2;
|
||||
double g2 = _g2;
|
||||
double b2 = _b2;
|
||||
double r, g, b;
|
||||
double rs, gs, bs;
|
||||
|
||||
if (start > end)
|
||||
{
|
||||
|
@ -376,9 +376,8 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
|
|||
if (start == end)
|
||||
{
|
||||
start = GPalette.Remap[start];
|
||||
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;
|
||||
Palette[start] = PalEntry(start == 0 ? 0 : 255, int(r), int(g), int(b));
|
||||
Remap[start] = ColorMatcher.Pick(Palette[start]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -388,8 +387,8 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
|
|||
for (int i = start; i <= end; ++i)
|
||||
{
|
||||
int j = GPalette.Remap[i];
|
||||
Remap[j] = ColorMatcher.Pick(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
Palette[j] = PalEntry(j == 0 ? 0 : 255, r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
|
||||
Palette[j] = PalEntry(j == 0 ? 0 : 255, int(r), int(g), int(b));
|
||||
Remap[j] = ColorMatcher.Pick(Palette[j]);
|
||||
r += rs;
|
||||
g += gs;
|
||||
b += bs;
|
||||
|
|
|
@ -105,6 +105,18 @@ FArchive &operator<< (FArchive &arc, FRenderStyle &style)
|
|||
return arc;
|
||||
}
|
||||
|
||||
double GetAlpha(int type, double alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return 1. - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FRenderStyle :: IsVisible
|
||||
|
@ -130,7 +142,7 @@ bool FRenderStyle::IsVisible(double alpha) const throw()
|
|||
{
|
||||
alpha = clamp(alpha, 0., 1.);
|
||||
}
|
||||
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != OPAQUE;
|
||||
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != 1;
|
||||
}
|
||||
// Treat anything else as visible.
|
||||
return true;
|
||||
|
@ -186,29 +198,3 @@ void FRenderStyle::CheckFuzz()
|
|||
BlendOp = STYLEOP_Fuzz;
|
||||
}
|
||||
}
|
||||
|
||||
fixed_t GetAlpha(int type, fixed_t alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return OPAQUE - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
fixed_t GetAlpha(int type, double alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return FLOAT2FIXED(alpha);
|
||||
case STYLEALPHA_InvSrc: return FLOAT2FIXED(1. - alpha);
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -165,7 +165,5 @@ inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
|
|||
class FArchive;
|
||||
|
||||
FArchive &operator<< (FArchive &arc, FRenderStyle &style);
|
||||
fixed_t GetAlpha(int type, fixed_t alpha);
|
||||
fixed_t GetAlpha(int type, double alpha);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -71,13 +71,13 @@ TDeletingArray<FVoxelDef *> VoxelDefs;
|
|||
struct VoxelOptions
|
||||
{
|
||||
VoxelOptions()
|
||||
: DroppedSpin(0), PlacedSpin(0), Scale(FRACUNIT), AngleOffset(ANGLE_90), OverridePalette(false)
|
||||
: DroppedSpin(0), PlacedSpin(0), Scale(1.), AngleOffset(90.), OverridePalette(false)
|
||||
{}
|
||||
|
||||
int DroppedSpin;
|
||||
int PlacedSpin;
|
||||
fixed_t Scale;
|
||||
angle_t AngleOffset;
|
||||
double Scale;
|
||||
DAngle AngleOffset;
|
||||
bool OverridePalette;
|
||||
};
|
||||
|
||||
|
@ -213,9 +213,9 @@ FVoxel *R_LoadKVX(int lumpnum)
|
|||
mipl->SizeX = GetInt(rawmip + 0);
|
||||
mipl->SizeY = GetInt(rawmip + 4);
|
||||
mipl->SizeZ = GetInt(rawmip + 8);
|
||||
mipl->PivotX = GetInt(rawmip + 12);
|
||||
mipl->PivotY = GetInt(rawmip + 16);
|
||||
mipl->PivotZ = GetInt(rawmip + 20);
|
||||
mipl->Pivot.X = GetInt(rawmip + 12) / 256.;
|
||||
mipl->Pivot.Y = GetInt(rawmip + 16) / 256.;
|
||||
mipl->Pivot.Z = GetInt(rawmip + 20) / 256.;
|
||||
|
||||
// How much space do we have for voxdata?
|
||||
int offsetsize = (mipl->SizeX + 1) * 4 + mipl->SizeX * (mipl->SizeY + 1) * 2;
|
||||
|
@ -300,9 +300,7 @@ FVoxel *R_LoadKVX(int lumpnum)
|
|||
// Fix pivot data for submips, since some tools seem to like to just center these.
|
||||
for (i = 1; i < mip; ++i)
|
||||
{
|
||||
voxel->Mips[i].PivotX = voxel->Mips[0].PivotX >> i;
|
||||
voxel->Mips[i].PivotY = voxel->Mips[0].PivotY >> i;
|
||||
voxel->Mips[i].PivotZ = voxel->Mips[0].PivotZ >> i;
|
||||
voxel->Mips[i].Pivot = voxel->Mips[i - 1].Pivot / 2;
|
||||
}
|
||||
|
||||
for (i = 0; i < mip; ++i)
|
||||
|
@ -339,9 +337,9 @@ FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin)
|
|||
{
|
||||
FVoxelDef *voxdef = new FVoxelDef;
|
||||
voxdef->Voxel = vox;
|
||||
voxdef->Scale = FRACUNIT;
|
||||
voxdef->Scale = 1.;
|
||||
voxdef->DroppedSpin = voxdef->PlacedSpin = spin;
|
||||
voxdef->AngleOffset = ANGLE_90;
|
||||
voxdef->AngleOffset = 90.;
|
||||
|
||||
Voxels.Push(vox);
|
||||
VoxelDefs.Push(voxdef);
|
||||
|
@ -358,7 +356,7 @@ FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin)
|
|||
FVoxelMipLevel::FVoxelMipLevel()
|
||||
{
|
||||
SizeZ = SizeY = SizeX = 0;
|
||||
PivotZ = PivotY = PivotX = 0;
|
||||
Pivot.Zero();
|
||||
OffsetX = NULL;
|
||||
OffsetXY = NULL;
|
||||
SlabData = NULL;
|
||||
|
@ -499,7 +497,7 @@ static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts)
|
|||
{
|
||||
sc.MustGetToken('=');
|
||||
sc.MustGetToken(TK_FloatConst);
|
||||
opts.Scale = FLOAT2FIXED(sc.Float);
|
||||
opts.Scale = sc.Float;
|
||||
}
|
||||
else if (sc.Compare("spin"))
|
||||
{
|
||||
|
@ -531,7 +529,7 @@ static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts)
|
|||
{
|
||||
sc.TokenMustBe(TK_FloatConst);
|
||||
}
|
||||
opts.AngleOffset = ANGLE_90 + FLOAT2ANGLE(sc.Float);
|
||||
opts.AngleOffset = sc.Float + 90.;
|
||||
}
|
||||
else if (sc.Compare("overridepalette"))
|
||||
{
|
||||
|
|
|
@ -23,9 +23,7 @@ struct FVoxelMipLevel
|
|||
int SizeX;
|
||||
int SizeY;
|
||||
int SizeZ;
|
||||
fixed_t PivotX; // 24.8 fixed point
|
||||
fixed_t PivotY; // ""
|
||||
fixed_t PivotZ; // ""
|
||||
DVector3 Pivot;
|
||||
int *OffsetX;
|
||||
short *OffsetXY;
|
||||
BYTE *SlabData;
|
||||
|
@ -51,8 +49,8 @@ struct FVoxelDef
|
|||
int PlacedSpin; // degrees/sec to spin actors without MF_DROPPED set
|
||||
int DroppedSpin; // degrees/sec to spin actors with MF_DROPPED set
|
||||
int VoxeldefIndex; // Needed by GZDoom
|
||||
fixed_t Scale;
|
||||
angle_t AngleOffset; // added to actor's angle to compensate for wrong-facing voxels
|
||||
double Scale;
|
||||
DAngle AngleOffset;// added to actor's angle to compensate for wrong-facing voxels
|
||||
};
|
||||
|
||||
extern TDeletingArray<FVoxel *> Voxels; // used only to auto-delete voxels on exit.
|
||||
|
|
|
@ -2350,6 +2350,18 @@ static bool R_SetBlendFunc (int op, fixed_t fglevel, fixed_t bglevel, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
static fixed_t GetAlpha(int type, fixed_t alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return OPAQUE - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, DWORD color)
|
||||
{
|
||||
fixed_t fglevel, bglevel;
|
||||
|
|
|
@ -918,10 +918,11 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
}
|
||||
else
|
||||
{
|
||||
xscale = FixedMul(spritescaleX, voxel->Scale);
|
||||
yscale = FixedMul(spritescaleY, voxel->Scale);
|
||||
gzt = fz + MulScale8(yscale, voxel->Voxel->Mips[0].PivotZ) - FLOAT2FIXED(thing->Floorclip);
|
||||
gzb = fz + MulScale8(yscale, voxel->Voxel->Mips[0].PivotZ - (voxel->Voxel->Mips[0].SizeZ << 8));
|
||||
xscale = fixed_t(spritescaleX * voxel->Scale);
|
||||
yscale = fixed_t(spritescaleY * voxel->Scale);
|
||||
fixed_t piv = fixed_t(voxel->Voxel->Mips[0].Pivot.Z*256.);
|
||||
gzt = fz + MulScale8(yscale, piv) - FLOAT2FIXED(thing->Floorclip);
|
||||
gzb = fz + MulScale8(yscale, piv - (voxel->Voxel->Mips[0].SizeZ << 8));
|
||||
if (gzt <= gzb)
|
||||
return;
|
||||
}
|
||||
|
@ -1030,7 +1031,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
|
||||
fz -= FLOAT2FIXED(thing->Floorclip);
|
||||
|
||||
vis->angle = thing->_f_angle() + voxel->AngleOffset;
|
||||
vis->angle = thing->Angles.Yaw.BAMs() + voxel->AngleOffset.BAMs();
|
||||
|
||||
int voxelspin = (thing->flags & MF_DROPPED) ? voxel->DroppedSpin : voxel->PlacedSpin;
|
||||
if (voxelspin != 0)
|
||||
|
@ -2728,18 +2729,22 @@ void R_DrawVoxel(fixed_t globalposx, fixed_t globalposy, fixed_t globalposz, ang
|
|||
daxscalerecip = (1<<30) / daxscale;
|
||||
dayscalerecip = (1<<30) / dayscale;
|
||||
|
||||
fixed_t piv_x = fixed_t(mip->Pivot.X*256.);
|
||||
fixed_t piv_y = fixed_t(mip->Pivot.Y*256.);
|
||||
fixed_t piv_z = fixed_t(mip->Pivot.Z*256.);
|
||||
|
||||
x = FixedMul(globalposx - dasprx, daxscalerecip);
|
||||
y = FixedMul(globalposy - daspry, daxscalerecip);
|
||||
backx = (DMulScale10(x, sprcosang, y, sprsinang) + mip->PivotX) >> 8;
|
||||
backy = (DMulScale10(y, sprcosang, x, -sprsinang) + mip->PivotY) >> 8;
|
||||
backx = (DMulScale10(x, sprcosang, y, sprsinang) + piv_x) >> 8;
|
||||
backy = (DMulScale10(y, sprcosang, x, -sprsinang) + piv_y) >> 8;
|
||||
cbackx = clamp(backx, 0, mip->SizeX - 1);
|
||||
cbacky = clamp(backy, 0, mip->SizeY - 1);
|
||||
|
||||
sprcosang = MulScale14(daxscale, sprcosang);
|
||||
sprsinang = MulScale14(daxscale, sprsinang);
|
||||
|
||||
x = (dasprx - globalposx) - DMulScale18(mip->PivotX, sprcosang, mip->PivotY, -sprsinang);
|
||||
y = (daspry - globalposy) - DMulScale18(mip->PivotY, sprcosang, mip->PivotX, sprsinang);
|
||||
x = (dasprx - globalposx) - DMulScale18(piv_x, sprcosang, piv_y, -sprsinang);
|
||||
y = (daspry - globalposy) - DMulScale18(piv_y, sprcosang, piv_x, sprsinang);
|
||||
|
||||
cosang = FixedMul(cosang, dayscalerecip);
|
||||
sinang = FixedMul(sinang, dayscalerecip);
|
||||
|
@ -2759,7 +2764,7 @@ void R_DrawVoxel(fixed_t globalposx, fixed_t globalposy, fixed_t globalposz, ang
|
|||
ggyinc[i] = y; y += gyinc;
|
||||
}
|
||||
|
||||
syoff = DivScale21(globalposz - dasprz, FixedMul(dazscale, 0xE800)) + (mip->PivotZ << 7);
|
||||
syoff = DivScale21(globalposz - dasprz, FixedMul(dazscale, 0xE800)) + (piv_z << 7);
|
||||
yoff = (abs(gxinc) + abs(gyinc)) >> 1;
|
||||
|
||||
for (cnt = 0; cnt < 8; cnt++)
|
||||
|
|
|
@ -146,9 +146,9 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in
|
|||
a = TSrc::A(pin, tr, tg, tb);
|
||||
if (TBlend::ProcessAlpha0() || a)
|
||||
{
|
||||
r = (TSrc::R(pin)*inf->blendcolor[0])>>FRACBITS;
|
||||
g = (TSrc::G(pin)*inf->blendcolor[1])>>FRACBITS;
|
||||
b = (TSrc::B(pin)*inf->blendcolor[2])>>FRACBITS;
|
||||
r = (TSrc::R(pin)*inf->blendcolor[0])>>BLENDBITS;
|
||||
g = (TSrc::G(pin)*inf->blendcolor[1])>>BLENDBITS;
|
||||
b = (TSrc::B(pin)*inf->blendcolor[2])>>BLENDBITS;
|
||||
|
||||
TBlend::OpC(pout[TDest::RED], r, a, inf);
|
||||
TBlend::OpC(pout[TDest::GREEN], g, a, inf);
|
||||
|
@ -167,9 +167,9 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in
|
|||
a = TSrc::A(pin, tr, tg, tb);
|
||||
if (TBlend::ProcessAlpha0() || a)
|
||||
{
|
||||
r = (TSrc::R(pin)*inf->blendcolor[3] + inf->blendcolor[0]) >> FRACBITS;
|
||||
g = (TSrc::G(pin)*inf->blendcolor[3] + inf->blendcolor[1]) >> FRACBITS;
|
||||
b = (TSrc::B(pin)*inf->blendcolor[3] + inf->blendcolor[2]) >> FRACBITS;
|
||||
r = (TSrc::R(pin)*inf->blendcolor[3] + inf->blendcolor[0]) >> BLENDBITS;
|
||||
g = (TSrc::G(pin)*inf->blendcolor[3] + inf->blendcolor[1]) >> BLENDBITS;
|
||||
b = (TSrc::B(pin)*inf->blendcolor[3] + inf->blendcolor[2]) >> BLENDBITS;
|
||||
|
||||
TBlend::OpC(pout[TDest::RED], r, a, inf);
|
||||
TBlend::OpC(pout[TDest::GREEN], g, a, inf);
|
||||
|
|
|
@ -48,6 +48,14 @@ struct FClipRect
|
|||
bool Intersect(int ix, int iy, int iw, int ih);
|
||||
};
|
||||
|
||||
typedef int blend_t;
|
||||
|
||||
enum
|
||||
{
|
||||
BLENDBITS = 16,
|
||||
BLENDUNIT = (1<<BLENDBITS)
|
||||
};
|
||||
|
||||
class FBitmap
|
||||
{
|
||||
protected:
|
||||
|
@ -338,9 +346,9 @@ struct FCopyInfo
|
|||
{
|
||||
ECopyOp op;
|
||||
EBlend blend;
|
||||
fixed_t blendcolor[4];
|
||||
fixed_t alpha;
|
||||
fixed_t invalpha;
|
||||
blend_t blendcolor[4];
|
||||
blend_t alpha;
|
||||
blend_t invalpha;
|
||||
};
|
||||
|
||||
struct bOverwrite
|
||||
|
@ -360,7 +368,7 @@ struct bCopy
|
|||
struct bCopyNewAlpha
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = (s*i->alpha) >> FRACBITS; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = (s*i->alpha) >> BLENDBITS; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
|
@ -380,28 +388,28 @@ struct bOverlay
|
|||
|
||||
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 OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (d*i->invalpha + s*i->alpha) >> BLENDBITS; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
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 OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MIN<int>((d*BLENDUNIT + s*i->alpha) >> BLENDBITS, 255); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
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 OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX<int>((d*BLENDUNIT - s*i->alpha) >> BLENDBITS, 0); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
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 OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX<int>((-d*BLENDUNIT + s*i->alpha) >> BLENDBITS, 0); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
|
|
@ -180,7 +180,7 @@ protected:
|
|||
FRemapTable *Translation;
|
||||
PalEntry Blend;
|
||||
FTexture *Texture;
|
||||
fixed_t Alpha;
|
||||
blend_t Alpha;
|
||||
|
||||
TexPart();
|
||||
};
|
||||
|
@ -593,7 +593,7 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota
|
|||
|
||||
memset (&info, 0, sizeof(info));
|
||||
info.alpha = Parts[i].Alpha;
|
||||
info.invalpha = OPAQUE - info.alpha;
|
||||
info.invalpha = BLENDUNIT - info.alpha;
|
||||
info.op = ECopyOp(Parts[i].op);
|
||||
PalEntry b = Parts[i].Blend;
|
||||
if (b.a == 0 && b != BLEND_NONE)
|
||||
|
@ -604,14 +604,14 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota
|
|||
{
|
||||
if (b.a == 255)
|
||||
{
|
||||
info.blendcolor[0] = b.r * FRACUNIT / 255;
|
||||
info.blendcolor[1] = b.g * FRACUNIT / 255;
|
||||
info.blendcolor[2] = b.b * FRACUNIT / 255;
|
||||
info.blendcolor[0] = b.r * BLENDUNIT / 255;
|
||||
info.blendcolor[1] = b.g * BLENDUNIT / 255;
|
||||
info.blendcolor[2] = b.b * BLENDUNIT / 255;
|
||||
info.blend = BLEND_MODULATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t blendalpha = b.a * FRACUNIT / 255;
|
||||
blend_t blendalpha = b.a * BLENDUNIT / 255;
|
||||
info.blendcolor[0] = b.r * blendalpha;
|
||||
info.blendcolor[1] = b.g * blendalpha;
|
||||
info.blendcolor[2] = b.b * blendalpha;
|
||||
|
@ -1165,7 +1165,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i
|
|||
else if (sc.Compare("alpha"))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
part.Alpha = clamp<fixed_t>(FLOAT2FIXED(sc.Float), 0, OPAQUE);
|
||||
part.Alpha = clamp<blend_t>(int(sc.Float / BLENDUNIT), 0, BLENDUNIT);
|
||||
// bComplex is not set because it is only needed when the style is not OP_COPY.
|
||||
}
|
||||
else if (sc.Compare("style"))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __TEXTURES_H
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
struct FloatRect
|
||||
{
|
||||
|
@ -227,9 +228,10 @@ public:
|
|||
|
||||
int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); }
|
||||
int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); }
|
||||
int GetScaledHeight(fixed_t scale) { int foo = (Height << 17) / scale; return (foo >> 1) + (foo & 1); }
|
||||
int GetScaledHeight(double scale) { return GetScaledHeight(FLOAT2FIXED(scale)); }
|
||||
double GetScaledWidthDouble () { return (Width * 65536.) / xScale; }
|
||||
double GetScaledHeightDouble () { return (Height * 65536.) / yScale; }
|
||||
double GetScaleY() const { return FIXED2DBL(yScale); }
|
||||
|
||||
int GetScaledLeftOffset () { int foo = (LeftOffset << 17) / xScale; return (foo >> 1) + (foo & 1); }
|
||||
int GetScaledTopOffset () { int foo = (TopOffset << 17) / yScale; return (foo >> 1) + (foo & 1); }
|
||||
|
|
|
@ -1152,7 +1152,7 @@ void DCanvas::Clear (int left, int top, int right, int bottom, int palcolor, uin
|
|||
//==========================================================================
|
||||
|
||||
void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley, angle_t rotation,
|
||||
double originx, double originy, double scalex, double scaley, DAngle rotation,
|
||||
FDynamicColormap *colormap, int lightlevel)
|
||||
{
|
||||
#ifndef NO_SWRENDER
|
||||
|
@ -1163,8 +1163,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
int i;
|
||||
int y1, y2, y;
|
||||
fixed_t x;
|
||||
double rot = rotation * M_PI / double(1u << 31);
|
||||
bool dorotate = rot != 0;
|
||||
bool dorotate = rotation != 0.;
|
||||
double cosrot, sinrot;
|
||||
|
||||
if (--npoints < 2 || Buffer == NULL)
|
||||
|
@ -1205,8 +1204,9 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
scalex /= FIXED2DBL(tex->xScale);
|
||||
scaley /= FIXED2DBL(tex->yScale);
|
||||
|
||||
cosrot = cos(rot);
|
||||
sinrot = sin(rot);
|
||||
// Use the CRT's functions here.
|
||||
cosrot = cos(ToRadians(rotation));
|
||||
sinrot = sin(ToRadians(rotation));
|
||||
|
||||
// Setup constant texture mapping parameters.
|
||||
R_SetupSpanBits(tex);
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
|
||||
// Fill a simple polygon with a texture
|
||||
virtual void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley, angle_t rotation,
|
||||
double originx, double originy, double scalex, double scaley, DAngle rotation,
|
||||
struct FDynamicColormap *colormap, int lightlevel);
|
||||
|
||||
// Set an area to a specified color
|
||||
|
|
|
@ -3071,7 +3071,7 @@ void D3DFB::FlatFill(int left, int top, int right, int bottom, FTexture *src, bo
|
|||
|
||||
void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
angle_t rotation, FDynamicColormap *colormap, int lightlevel)
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel)
|
||||
{
|
||||
// Use an equation similar to player sprites to determine shade
|
||||
fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT;
|
||||
|
@ -3083,8 +3083,7 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
|||
D3DCOLOR color0, color1;
|
||||
float ox, oy;
|
||||
float cosrot, sinrot;
|
||||
float rot = float(rotation * M_PI / float(1u << 31));
|
||||
bool dorotate = rot != 0;
|
||||
bool dorotate = rotation != 0;
|
||||
|
||||
if (npoints < 3)
|
||||
{ // This is no polygon.
|
||||
|
@ -3105,8 +3104,8 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
|||
return;
|
||||
}
|
||||
|
||||
cosrot = (float)cos(rot);
|
||||
sinrot = (float)sin(rot);
|
||||
cosrot = (float)cos(ToRadians(rotation));
|
||||
sinrot = (float)sin(ToRadians(rotation));
|
||||
|
||||
CheckQuadBatch(npoints - 2, npoints);
|
||||
quad = &QuadExtra[QuadBatchPos];
|
||||
|
|
|
@ -265,7 +265,7 @@ public:
|
|||
void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
angle_t rotation, FDynamicColormap *colormap, int lightlevel);
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel);
|
||||
bool WipeStartScreen(int type);
|
||||
void WipeEndScreen();
|
||||
bool WipeDo(int ticks);
|
||||
|
|
Loading…
Reference in a new issue