- Fixed: Wall drawing handled fixed light levels improperly (but did not

completely ignore them, either).
- Separated light level fixing out of player_t's fixedcolormap parameter.
  Using a fixed light level (e.g. PowerTorch) will no longer wipe out
  colored lighting.
- Moved the blending rectangle drawing into a separate discrete stage, since
  doing it while copying the 3D view window to the display now blends
  underneath the weapon instead of on top of it.
- Consolidated the special colormaps into a single 2D table.
- Tweaked the special colormaps slightly to make the true color results more
  closely match the paletted approximations.
- fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the
  executable and into zdoom.pk3. Shaders are still precompiled so I don't need
  to pull in a dependancy on D3DX.
- Added a few more shaders to accomodate drawing weapons with all the in-game
  lighting models. These are accessed with the new DrawTexture tags
  DTA_SpecialColormap and DTA_ColormapStyle.
- Player weapon sprites are now drawn using Direct3D and receive all the
  benefits thereof.


SVN r1858 (trunk)
This commit is contained in:
Randy Heit 2009-09-20 03:50:05 +00:00
parent 857002e12f
commit b8eb530a0d
93 changed files with 1260 additions and 1360 deletions

View file

@ -1,3 +1,24 @@
September 19, 2009
- Fixed: Wall drawing handled fixed light levels improperly (but did not
completely ignore them, either).
- Separated light level fixing out of player_t's fixedcolormap parameter.
Using a fixed light level (e.g. PowerTorch) will no longer wipe out
colored lighting.
- Moved the blending rectangle drawing into a separate discrete stage, since
doing it while copying the 3D view window to the display now blends
underneath the weapon instead of on top of it.
- Consolidated the special colormaps into a single 2D table.
- Tweaked the special colormaps slightly to make the true color results more
closely match the paletted approximations.
- fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the
executable and into zdoom.pk3. Shaders are still precompiled so I don't need
to pull in a dependancy on D3DX.
- Added a few more shaders to accomodate drawing weapons with all the in-game
lighting models. These are accessed with the new DrawTexture tags
DTA_SpecialColormap and DTA_ColormapStyle.
- Player weapon sprites are now drawn using Direct3D and receive all the
benefits thereof.
September 17, 2009 (Changes by Graf Zahl) September 17, 2009 (Changes by Graf Zahl)
- Fixed: Unmorphing while invulnerable was blocked. - Fixed: Unmorphing while invulnerable was blocked.
- Various cleanup changes. - Various cleanup changes.

View file

@ -681,6 +681,8 @@ void D_Display ()
SB_state = screen->GetPageCount(); SB_state = screen->GetPageCount();
BorderNeedRefresh = screen->GetPageCount(); BorderNeedRefresh = screen->GetPageCount();
} }
R_DrawRemainingPlayerSprites();
screen->DrawBlendingRect();
if (automapactive) if (automapactive)
{ {
int saved_ST_Y = ST_Y; int saved_ST_Y = ST_Y;

View file

@ -303,7 +303,8 @@ public:
TObjPtr<AActor> poisoner; // NULL for non-player actors TObjPtr<AActor> poisoner; // NULL for non-player actors
TObjPtr<AActor> attacker; // who did damage (NULL for floors) TObjPtr<AActor> attacker; // who did damage (NULL for floors)
int extralight; // so gun flashes light up areas int extralight; // so gun flashes light up areas
int fixedcolormap; // can be set to REDCOLORMAP, etc. short fixedcolormap; // can be set to REDCOLORMAP, etc.
short fixedlightlevel;
pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc)
int morphTics; // player is a chicken/pig if > 0 int morphTics; // player is a chicken/pig if > 0
BYTE MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed BYTE MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed

View file

@ -1195,7 +1195,8 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory
p->mo->RenderStyle = STYLE_Normal; p->mo->RenderStyle = STYLE_Normal;
p->mo->alpha = FRACUNIT; p->mo->alpha = FRACUNIT;
p->extralight = 0; // cancel gun flashes p->extralight = 0; // cancel gun flashes
p->fixedcolormap = 0; // cancel ir goggles p->fixedcolormap = NOFIXEDCOLORMAP; // cancel ir goggles
p->fixedlightlevel = -1;
p->damagecount = 0; // no palette changes p->damagecount = 0; // no palette changes
p->bonuscount = 0; p->bonuscount = 0;
p->poisoncount = 0; p->poisoncount = 0;

View file

@ -205,7 +205,7 @@ void APowerup::DoEffect ()
(BlendColor == GREENCOLOR && Owner->player->fixedcolormap == GREENCOLORMAP) || (BlendColor == GREENCOLOR && Owner->player->fixedcolormap == GREENCOLORMAP) ||
(BlendColor == BLUECOLOR && Owner->player->fixedcolormap == BLUECOLORMAP)) (BlendColor == BLUECOLOR && Owner->player->fixedcolormap == BLUECOLORMAP))
{ {
Owner->player->fixedcolormap = 0; Owner->player->fixedcolormap = NOFIXEDCOLORMAP;
} }
} }
} }
@ -471,7 +471,7 @@ void APowerInvulnerable::EndEffect ()
if (Owner->player != NULL) if (Owner->player != NULL)
{ {
Owner->player->fixedcolormap = 0; Owner->player->fixedcolormap = NOFIXEDCOLORMAP;
} }
} }
@ -711,7 +711,7 @@ int APowerInvisibility::AlterWeaponSprite (vissprite_t *vis)
if ((vis->alpha < TRANSLUC25 && special1 > 0) || (vis->alpha == 0)) if ((vis->alpha < TRANSLUC25 && special1 > 0) || (vis->alpha == 0))
{ {
vis->alpha = clamp<fixed_t>((OPAQUE - Strength), 0, OPAQUE); vis->alpha = clamp<fixed_t>((OPAQUE - Strength), 0, OPAQUE);
vis->colormap = InverseColormap; vis->colormap = SpecialColormaps[INVERSECOLORMAP];
} }
return -1; // This item is valid so another one shouldn't reset the translucency return -1; // This item is valid so another one shouldn't reset the translucency
} }
@ -830,11 +830,11 @@ void APowerLightAmp::DoEffect ()
{ {
if (EffectTics > BLINKTHRESHOLD || (EffectTics & 8)) if (EffectTics > BLINKTHRESHOLD || (EffectTics & 8))
{ {
Owner->player->fixedcolormap = 1; Owner->player->fixedlightlevel = 1;
} }
else else
{ {
Owner->player->fixedcolormap = 0; Owner->player->fixedlightlevel = -1;
} }
} }
} }
@ -849,7 +849,7 @@ void APowerLightAmp::EndEffect ()
{ {
if (Owner != NULL && Owner->player != NULL && Owner->player->fixedcolormap < NUMCOLORMAPS) if (Owner != NULL && Owner->player != NULL && Owner->player->fixedcolormap < NUMCOLORMAPS)
{ {
Owner->player->fixedcolormap = 0; Owner->player->fixedlightlevel = -1;
} }
} }
@ -894,22 +894,22 @@ void APowerTorch::DoEffect ()
{ {
if (NewTorch != 0) if (NewTorch != 0)
{ {
if (Owner->player->fixedcolormap + NewTorchDelta > 7 if (Owner->player->fixedlightlevel + NewTorchDelta > 7
|| Owner->player->fixedcolormap + NewTorchDelta < 1 || Owner->player->fixedlightlevel + NewTorchDelta < 0
|| NewTorch == Owner->player->fixedcolormap) || NewTorch == Owner->player->fixedlightlevel)
{ {
NewTorch = 0; NewTorch = 0;
} }
else else
{ {
Owner->player->fixedcolormap += NewTorchDelta; Owner->player->fixedlightlevel += NewTorchDelta;
} }
} }
else else
{ {
NewTorch = (pr_torch() & 7) + 1; NewTorch = (pr_torch() & 7) + 1;
NewTorchDelta = (NewTorch == Owner->player->fixedcolormap) ? NewTorchDelta = (NewTorch == Owner->player->fixedlightlevel) ?
0 : ((NewTorch > Owner->player->fixedcolormap) ? 1 : -1); 0 : ((NewTorch > Owner->player->fixedlightlevel) ? 1 : -1);
} }
} }
} }

View file

@ -3899,7 +3899,8 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
p->MorphStyle = 0; p->MorphStyle = 0;
p->MorphExitFlash = NULL; p->MorphExitFlash = NULL;
p->extralight = 0; p->extralight = 0;
p->fixedcolormap = 0; p->fixedcolormap = NOFIXEDCOLORMAP;
p->fixedlightlevel = -1;
p->viewheight = mobj->ViewHeight; p->viewheight = mobj->ViewHeight;
p->inconsistant = 0; p->inconsistant = 0;
p->attacker = NULL; p->attacker = NULL;

View file

@ -2508,9 +2508,27 @@ void player_t::Serialize (FArchive &arc)
<< poisoncount << poisoncount
<< poisoner << poisoner
<< attacker << attacker
<< extralight << extralight;
<< fixedcolormap if (SaveVersion < 1858)
<< morphTics {
int fixedmap;
arc << fixedmap;
fixedcolormap = NOFIXEDCOLORMAP;
fixedlightlev = -1;
if (fixedmap >= NUMCOLORMAPS)
{
fixedcolormap = fixedmap - NUMCOLORMAPS;
}
else if (fixedmap > 0)
{
fixedlightlev = fixedmap;
}
}
else
{
arc << fixedcolormap << fixedlightlev;
}
arc << morphTics
<< MorphedPlayerClass << MorphedPlayerClass
<< MorphStyle << MorphStyle
<< MorphExitFlash << MorphExitFlash

View file

@ -114,10 +114,10 @@ union FRenderStyle
BYTE DestAlpha; // Of ERenderAlpha type BYTE DestAlpha; // Of ERenderAlpha type
BYTE Flags; BYTE Flags;
}; };
DWORD AsDWORD; uint32 AsDWORD;
inline FRenderStyle &operator= (ERenderStyle legacy); inline FRenderStyle &operator= (ERenderStyle legacy);
operator DWORD() const { return AsDWORD; } operator uint32() const { return AsDWORD; }
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; } bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
void CheckFuzz(); void CheckFuzz();
bool IsVisible(fixed_t alpha) const throw(); bool IsVisible(fixed_t alpha) const throw();

View file

@ -2205,7 +2205,7 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
hcolfunc_post4 = rt_shaded4cols; hcolfunc_post4 = rt_shaded4cols;
dc_color = fixedcolormap ? fixedcolormap[APART(color)] : basecolormap->Maps[APART(color)]; dc_color = fixedcolormap ? fixedcolormap[APART(color)] : basecolormap->Maps[APART(color)];
dc_colormap = (basecolormap = &ShadeFakeColormap[16-alpha])->Maps; dc_colormap = (basecolormap = &ShadeFakeColormap[16-alpha])->Maps;
if (fixedlightlev && !fixedcolormap) if (fixedlightlev >= 0 && fixedcolormap == NULL)
{ {
dc_colormap += fixedlightlev; dc_colormap += fixedlightlev;
} }

View file

@ -1159,45 +1159,23 @@ void R_SetupFrame (AActor *actor)
} }
fixedcolormap = NULL; fixedcolormap = NULL;
fixedlightlev = 0; fixedlightlev = -1;
if (player != NULL && camera == player->mo && player->fixedcolormap) if (player != NULL && camera == player->mo)
{ {
if (player->fixedcolormap < NUMCOLORMAPS) if (player->fixedcolormap >= 0 && player->fixedcolormap < NUM_SPECIALCOLORMAPS)
{ {
fixedlightlev = player->fixedcolormap*256; fixedcolormap = SpecialColormaps[player->fixedcolormap];
fixedcolormap = NormalLight.Maps;
} }
else switch (player->fixedcolormap) else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
{ {
case INVERSECOLORMAP: fixedlightlev = player->fixedlightlevel * 256;
fixedcolormap = InverseColormap;
break;
case REDCOLORMAP:
fixedcolormap = RedColormap;
break;
case GREENCOLORMAP:
fixedcolormap = GreenColormap;
break;
case BLUECOLORMAP:
fixedcolormap = BlueColormap;
break;
case GOLDCOLORMAP:
fixedcolormap = GoldColormap;
break;
default:
break;
} }
} }
// [RH] Inverse light for shooting the Sigil // [RH] Inverse light for shooting the Sigil
else if (extralight == INT_MIN) if (fixedcolormap == NULL && extralight == INT_MIN)
{ {
fixedcolormap = InverseColormap; fixedcolormap = SpecialColormaps[INVERSECOLORMAP];
extralight = 0; extralight = 0;
} }

View file

@ -30,6 +30,7 @@
#include "d_player.h" #include "d_player.h"
#include "r_data.h" #include "r_data.h"
#include "r_state.h" #include "r_state.h"
#include "v_palette.h"
// //
@ -88,12 +89,6 @@ extern bool r_dontmaplines;
// 16 discrete light levels. The terminology I use is borrowed from Build. // 16 discrete light levels. The terminology I use is borrowed from Build.
// //
#define INVERSECOLORMAP 32
#define GOLDCOLORMAP 33
#define REDCOLORMAP 34
#define GREENCOLORMAP 35
#define BLUECOLORMAP 36
// The size of a single colormap, in bits // The size of a single colormap, in bits
#define COLORMAPSHIFT 8 #define COLORMAPSHIFT 8

View file

@ -1407,7 +1407,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked)
planeheight = abs (FixedMul (pl->height.d, -pl->height.ic) - viewz); planeheight = abs (FixedMul (pl->height.d, -pl->height.ic) - viewz);
GlobVis = FixedDiv (r_FloorVisibility, planeheight); GlobVis = FixedDiv (r_FloorVisibility, planeheight);
if (fixedlightlev) if (fixedlightlev >= 0)
ds_colormap = basecolormap->Maps + fixedlightlev, plane_shade = false; ds_colormap = basecolormap->Maps + fixedlightlev, plane_shade = false;
else if (fixedcolormap) else if (fixedcolormap)
ds_colormap = fixedcolormap, plane_shade = false; ds_colormap = fixedcolormap, plane_shade = false;
@ -1545,7 +1545,7 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked)
if (pl->height.c > 0) if (pl->height.c > 0)
planelightfloat = -planelightfloat; planelightfloat = -planelightfloat;
if (fixedlightlev) if (fixedlightlev >= 0)
ds_colormap = basecolormap->Maps + fixedlightlev, plane_shade = false; ds_colormap = basecolormap->Maps + fixedlightlev, plane_shade = false;
else if (fixedcolormap) else if (fixedcolormap)
ds_colormap = fixedcolormap, plane_shade = false; ds_colormap = fixedcolormap, plane_shade = false;

View file

@ -154,7 +154,7 @@ CVAR(Bool, r_fogboundary, true, 0)
inline bool IsFogBoundary (sector_t *front, sector_t *back) inline bool IsFogBoundary (sector_t *front, sector_t *back)
{ {
return r_fogboundary && !fixedcolormap && front->ColorMap->Fade && return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade &&
front->ColorMap->Fade != back->ColorMap->Fade && front->ColorMap->Fade != back->ColorMap->Fade &&
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum); (front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
} }
@ -179,7 +179,7 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText
if (maskedtexturecol[dc_x] != FIXED_MAX) if (maskedtexturecol[dc_x] != FIXED_MAX)
{ {
// calculate lighting // calculate lighting
if (!fixedcolormap) if (fixedcolormap == NULL && fixedlightlev < 0)
{ {
dc_colormap = basecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormap->Maps + (GETPALOOKUP (rw_light, wallshade) << COLORMAPSHIFT);
} }
@ -298,9 +298,9 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
} }
} }
if (fixedlightlev) if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev; dc_colormap = basecolormap->Maps + fixedlightlev;
else if (fixedcolormap) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
if (!(curline->linedef->flags & ML_WRAP_MIDTEX) && if (!(curline->linedef->flags & ML_WRAP_MIDTEX) &&
@ -453,7 +453,8 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t
x = x1; x = x1;
//while ((umost[x] > dmost[x]) && (x <= x2)) x++; //while ((umost[x] > dmost[x]) && (x <= x2)) x++;
if (fixedcolormap) bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
if (fixed)
{ {
palookupoffse[0] = dc_colormap; palookupoffse[0] = dc_colormap;
palookupoffse[1] = dc_colormap; palookupoffse[1] = dc_colormap;
@ -470,7 +471,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t
assert (y1ve[0] < viewheight); assert (y1ve[0] < viewheight);
assert (y2ve[0] <= viewheight); assert (y2ve[0] <= viewheight);
if (!fixedcolormap) if (!fixed)
{ // calculate lighting { // calculate lighting
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
} }
@ -505,7 +506,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t
continue; continue;
} }
if (!fixedcolormap) if (!fixed)
{ {
for (z = 0; z < 4; ++z) for (z = 0; z < 4; ++z)
{ {
@ -563,7 +564,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixed_t
assert (y1ve[0] < viewheight); assert (y1ve[0] < viewheight);
assert (y2ve[0] <= viewheight); assert (y2ve[0] <= viewheight);
if (!fixedcolormap) if (!fixed)
{ // calculate lighting { // calculate lighting
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
} }
@ -700,7 +701,8 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe
x = startx = x1; x = startx = x1;
p = x + dc_destorg; p = x + dc_destorg;
if (fixedcolormap) bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
if (fixed)
{ {
palookupoffse[0] = dc_colormap; palookupoffse[0] = dc_colormap;
palookupoffse[1] = dc_colormap; palookupoffse[1] = dc_colormap;
@ -715,7 +717,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]); y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue; if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap) if (!fixed)
{ // calculate lighting { // calculate lighting
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
} }
@ -748,7 +750,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe
continue; continue;
} }
if (!fixedcolormap) if (!fixed)
{ {
for (z = 0; z < 4; ++z) for (z = 0; z < 4; ++z)
{ {
@ -804,7 +806,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal, fixe
y2ve[0] = dwal[x]; y2ve[0] = dwal[x];
if (y2ve[0] <= y1ve[0]) continue; if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap) if (!fixed)
{ // calculate lighting { // calculate lighting
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
} }
@ -872,7 +874,8 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal,
x = startx = x1; x = startx = x1;
p = x + dc_destorg; p = x + dc_destorg;
if (fixedcolormap) bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
if (fixed)
{ {
palookupoffse[0] = dc_colormap; palookupoffse[0] = dc_colormap;
palookupoffse[1] = dc_colormap; palookupoffse[1] = dc_colormap;
@ -887,7 +890,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal,
y2ve[0] = dwal[x];//min(dwal[x],dmost[x]); y2ve[0] = dwal[x];//min(dwal[x],dmost[x]);
if (y2ve[0] <= y1ve[0]) continue; if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap) if (!fixed)
{ // calculate lighting { // calculate lighting
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
} }
@ -920,7 +923,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal,
continue; continue;
} }
if (!fixedcolormap) if (!fixed)
{ {
for (z = 0; z < 4; ++z) for (z = 0; z < 4; ++z)
{ {
@ -979,7 +982,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, fixed_t *swal,
y2ve[0] = dwal[x]; y2ve[0] = dwal[x];
if (y2ve[0] <= y1ve[0]) continue; if (y2ve[0] <= y1ve[0]) continue;
if (!fixedcolormap) if (!fixed)
{ // calculate lighting { // calculate lighting
dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT); dc_colormap = basecolormapdata + (GETPALOOKUP (light, wallshade) << COLORMAPSHIFT);
} }
@ -1016,9 +1019,9 @@ void R_RenderSegLoop ()
fixed_t xscale, yscale; fixed_t xscale, yscale;
fixed_t xoffset = rw_offset; fixed_t xoffset = rw_offset;
if (fixedlightlev) if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev; dc_colormap = basecolormap->Maps + fixedlightlev;
else if (fixedcolormap) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
// clip wall to the floor and ceiling // clip wall to the floor and ceiling
@ -1087,7 +1090,7 @@ void R_RenderSegLoop ()
{ {
rw_offset = rw_offset_mid; rw_offset = rw_offset_mid;
} }
if (fixedlightlev || fixedcolormap || !frontsector->ExtraLights) if (fixedcolormap != NULL || !frontsector->ExtraLights)
{ {
wallscan (x1, x2-1, walltop, wallbottom, swall, lwall, yscale); wallscan (x1, x2-1, walltop, wallbottom, swall, lwall, yscale);
} }
@ -1126,7 +1129,7 @@ void R_RenderSegLoop ()
{ {
rw_offset = rw_offset_top; rw_offset = rw_offset_top;
} }
if (fixedlightlev || fixedcolormap || !frontsector->ExtraLights) if (fixedcolormap != NULL || !frontsector->ExtraLights)
{ {
wallscan (x1, x2-1, walltop, wallupper, swall, lwall, yscale); wallscan (x1, x2-1, walltop, wallupper, swall, lwall, yscale);
} }
@ -1168,7 +1171,7 @@ void R_RenderSegLoop ()
{ {
rw_offset = rw_offset_bottom; rw_offset = rw_offset_bottom;
} }
if (fixedlightlev || fixedcolormap || !frontsector->ExtraLights) if (fixedcolormap != NULL || !frontsector->ExtraLights)
{ {
wallscan (x1, x2-1, walllower, wallbottom, swall, lwall, yscale); wallscan (x1, x2-1, walllower, wallbottom, swall, lwall, yscale);
} }
@ -1434,7 +1437,7 @@ void R_NewWall (bool needlights)
PrepWall (swall, lwall, sidedef->TexelLength * lwallscale); PrepWall (swall, lwall, sidedef->TexelLength * lwallscale);
if (!fixedcolormap) if (fixedcolormap == NULL && fixedlightlev < 0)
{ {
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel)
+ r_actualextralight); + r_actualextralight);
@ -2421,9 +2424,9 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
bool calclighting = false; bool calclighting = false;
rw_light = rw_lightleft + (x1 - WallSX1) * rw_lightstep; rw_light = rw_lightleft + (x1 - WallSX1) * rw_lightstep;
if (fixedlightlev) if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev; dc_colormap = basecolormap->Maps + fixedlightlev;
else if (fixedcolormap) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT)) else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
dc_colormap = basecolormap->Maps; dc_colormap = basecolormap->Maps;

View file

@ -50,6 +50,7 @@
#include "r_plane.h" #include "r_plane.h"
#include "r_segs.h" #include "r_segs.h"
#include "v_palette.h" #include "v_palette.h"
#include "r_translate.h"
extern fixed_t globaluclip, globaldclip; extern fixed_t globaluclip, globaldclip;
@ -74,6 +75,10 @@ fixed_t pspritexiscale;
fixed_t sky1scale; // [RH] Sky 1 scale factor fixed_t sky1scale; // [RH] Sky 1 scale factor
fixed_t sky2scale; // [RH] Sky 2 scale factor fixed_t sky2scale; // [RH] Sky 2 scale factor
vissprite_t *VisPSprites[NUMPSPRITES];
int VisPSpritesX1[NUMPSPRITES];
FDynamicColormap *VisPSpritesBaseColormap[NUMPSPRITES];
static int spriteshade; static int spriteshade;
TArray<WORD> ParticlesInSubsec; TArray<WORD> ParticlesInSubsec;
@ -1430,51 +1435,41 @@ void R_ProjectSprite (AActor *thing, int fakeside)
if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) if (vis->RenderStyle.Flags & STYLEF_FadeToBlack)
{ {
if (invertcolormap) if (invertcolormap)
{ { // Fade to white
// Fade to white
mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255,255,255), mybasecolormap->Desaturate); mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255,255,255), mybasecolormap->Desaturate);
invertcolormap = false; invertcolormap = false;
} }
else else
{ { // Fade to black
// Fade to black
mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0,0,0), mybasecolormap->Desaturate); mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0,0,0), mybasecolormap->Desaturate);
} }
} }
// get light level // get light level
if (fixedlightlev) if (fixedcolormap != NULL)
{ { // fixed map
if (invertcolormap)
{
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
}
vis->colormap = mybasecolormap->Maps + fixedlightlev;
}
else if (fixedcolormap)
{
// fixed map
vis->colormap = fixedcolormap; vis->colormap = fixedcolormap;
} }
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
{
// full bright
if (invertcolormap)
{
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
}
vis->colormap = mybasecolormap->Maps;
}
else else
{ {
// diminished light
if (invertcolormap) if (invertcolormap)
{ {
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
} }
if (fixedlightlev >= 0)
{
vis->colormap = mybasecolormap->Maps + fixedlightlev;
}
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
{ // full bright
vis->colormap = mybasecolormap->Maps;
}
else
{ // diminished light
vis->colormap = mybasecolormap->Maps + (GETPALOOKUP ( vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (
(fixed_t)DivScale12 (r_SpriteVisibility, tz), spriteshade) << COLORMAPSHIFT); (fixed_t)DivScale12 (r_SpriteVisibility, tz), spriteshade) << COLORMAPSHIFT);
} }
}
} }
@ -1522,7 +1517,10 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
WORD flip; WORD flip;
FTexture* tex; FTexture* tex;
vissprite_t* vis; vissprite_t* vis;
vissprite_t avis; static vissprite_t avis[NUMPSPRITES];
bool noaccel;
assert(pspnum >= 0 && pspnum < NUMPSPRITES);
// decide which patch to use // decide which patch to use
if ( (unsigned)psp->state->sprite >= (unsigned)sprites.Size ()) if ( (unsigned)psp->state->sprite >= (unsigned)sprites.Size ())
@ -1550,7 +1548,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
tx -= tex->GetScaledLeftOffset() << FRACBITS; tx -= tex->GetScaledLeftOffset() << FRACBITS;
x1 = (centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS; x1 = (centerxfrac + FixedMul (tx, pspritexscale)) >>FRACBITS;
VisPSpritesX1[pspnum] = x1;
// off the right side // off the right side
if (x1 > viewwidth) if (x1 > viewwidth)
@ -1564,7 +1562,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
return; return;
// store information in a vissprite // store information in a vissprite
vis = &avis; vis = &avis[pspnum];
vis->renderflags = owner->renderflags; vis->renderflags = owner->renderflags;
vis->floorclip = 0; vis->floorclip = 0;
@ -1619,6 +1617,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
if (vis->x1 > x1) if (vis->x1 > x1)
vis->startfrac += vis->xiscale*(vis->x1-x1); vis->startfrac += vis->xiscale*(vis->x1-x1);
noaccel = false;
if (pspnum <= ps_flash) if (pspnum <= ps_flash)
{ {
vis->alpha = owner->alpha; vis->alpha = owner->alpha;
@ -1639,67 +1638,92 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) if (vis->RenderStyle.Flags & STYLEF_FadeToBlack)
{ {
if (invertcolormap) if (invertcolormap)
{ { // Fade to white
// Fade to white
mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255,255,255), mybasecolormap->Desaturate); mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255,255,255), mybasecolormap->Desaturate);
invertcolormap = false; invertcolormap = false;
} }
else else
{ { // Fade to black
// Fade to black
mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0,0,0), mybasecolormap->Desaturate); mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0,0,0), mybasecolormap->Desaturate);
} }
} }
if (fixedlightlev) if (fixedcolormap != NULL)
{ { // fixed color
if (invertcolormap)
{
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
}
vis->colormap = mybasecolormap->Maps + fixedlightlev;
}
else if (fixedcolormap)
{
// fixed color
vis->colormap = fixedcolormap; vis->colormap = fixedcolormap;
} }
else if (!foggy && psp->state->GetFullbright()) else
{ {
// full bright
if (invertcolormap) if (invertcolormap)
{ {
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate); mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
} }
if (fixedlightlev >= 0)
{
vis->colormap = mybasecolormap->Maps + fixedlightlev;
}
else if (!foggy && psp->state->GetFullbright())
{ // full bright
vis->colormap = mybasecolormap->Maps; // [RH] use basecolormap vis->colormap = mybasecolormap->Maps; // [RH] use basecolormap
} }
else else
{ { // local light
// local light
if (invertcolormap)
{
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
}
vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT); vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT);
} }
}
if (camera->Inventory != NULL) if (camera->Inventory != NULL)
{ {
lighttable_t *oldcolormap = vis->colormap;
camera->Inventory->AlterWeaponSprite (vis); camera->Inventory->AlterWeaponSprite (vis);
if (vis->colormap != oldcolormap)
{
// The colormap has changed. Is it one we can easily identify?
// If not, then don't bother trying to identify it for
// hardware accelerated drawing.
if (vis->colormap < SpecialColormaps[0] || vis->colormap >= SpecialColormaps[NUM_SPECIALCOLORMAPS])
{
noaccel = true;
} }
// Has the basecolormap changed? If so, we can't hardware accelerate it,
// since we don't know what it is anymore.
else if (vis->colormap < mybasecolormap->Maps ||
vis->colormap >= mybasecolormap->Maps + NUMCOLORMAPS*256)
{
noaccel = true;
}
}
}
VisPSpritesBaseColormap[pspnum] = mybasecolormap;
} }
else else
{ {
VisPSpritesBaseColormap[pspnum] = basecolormap;
vis->RenderStyle = STYLE_Normal; vis->RenderStyle = STYLE_Normal;
} }
// Check for hardware-assisted 2D. If it's available, and this sprite is not
// fuzzy, don't draw it until after the switch to 2D mode.
if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
{
FRenderStyle style = vis->RenderStyle;
style.CheckFuzz();
if (style.BlendOp != STYLEOP_Fuzz)
{
VisPSprites[pspnum] = vis;
return;
}
}
R_DrawVisSprite (vis); R_DrawVisSprite (vis);
} }
//==========================================================================
// //
// R_DrawPlayerSprites // R_DrawPlayerSprites
// //
//==========================================================================
void R_DrawPlayerSprites (void) void R_DrawPlayerSprites (void)
{ {
int i; int i;
@ -1766,6 +1790,80 @@ void R_DrawPlayerSprites (void)
} }
} }
//==========================================================================
//
// R_DrawRemainingPlayerSprites
//
// Called from D_Display to draw sprites that were not drawn by
// R_DrawPlayerSprites().
//
//==========================================================================
void R_DrawRemainingPlayerSprites()
{
for (int i = 0; i < NUMPSPRITES; ++i)
{
vissprite_t *vis;
vis = VisPSprites[i];
VisPSprites[i] = NULL;
if (vis != NULL)
{
FDynamicColormap *colormap = VisPSpritesBaseColormap[i];
bool flip = vis->xiscale < 0;
FSpecialColormapParameters *special = NULL;
PalEntry overlay = 0;
FColormapStyle colormapstyle;
bool usecolormapstyle = false;
if (vis->colormap >= SpecialColormaps[0] && vis->colormap < SpecialColormaps[NUM_SPECIALCOLORMAPS])
{
ptrdiff_t specialmap = (vis->colormap - SpecialColormaps[0]) >> 8;
if (SpecialColormapParms[specialmap].Inverted)
{
vis->RenderStyle.Flags ^= STYLEF_InvertSource;
}
special = &SpecialColormapParms[specialmap];
}
else if (colormap->Color == PalEntry(255,255,255) &&
colormap->Desaturate == 0)
{
overlay = colormap->Fade;
overlay.a = BYTE(((vis->colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS);
}
else
{
usecolormapstyle = true;
colormapstyle.Color = colormap->Color;
colormapstyle.Fade = colormap->Fade;
colormapstyle.Desaturate = colormap->Desaturate;
colormapstyle.FadeLevel = ((vis->colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS);
}
screen->DrawTexture(vis->pic,
viewwindowx + VisPSpritesX1[i],
viewwindowy + viewheight/2 - MulScale32(vis->texturemid, vis->yscale) - 1,
DTA_DestWidth, FixedMul(vis->pic->GetWidth(), vis->xscale),
DTA_DestHeight, FixedMul(vis->pic->GetHeight(), vis->yscale),
DTA_Translation, TranslationToTable(vis->Translation),
DTA_FlipX, flip,
DTA_TopOffset, 0,
DTA_LeftOffset, 0,
DTA_ClipLeft, viewwindowx,
DTA_ClipTop, viewwindowy,
DTA_ClipRight, viewwindowx + viewwidth,
DTA_ClipBottom, viewwindowy + viewheight,
DTA_Alpha, vis->alpha,
DTA_RenderStyle, vis->RenderStyle,
DTA_FillColor, vis->FillColor,
DTA_SpecialColormap, special,
DTA_ColorOverlay, overlay,
DTA_ColormapStyle, usecolormapstyle ? &colormapstyle : NULL,
TAG_DONE);
}
}
}
@ -2423,7 +2521,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
vis->floorclip = 0; vis->floorclip = 0;
vis->heightsec = heightsec; vis->heightsec = heightsec;
if (fixedlightlev) if (fixedlightlev >= 0)
{ {
vis->colormap = map + fixedlightlev; vis->colormap = map + fixedlightlev;
} }

View file

@ -102,6 +102,7 @@ void R_InitSprites ();
void R_DeinitSprites (); void R_DeinitSprites ();
void R_ClearSprites (); void R_ClearSprites ();
void R_DrawMasked (); void R_DrawMasked ();
void R_DrawRemainingPlayerSprites ();
void R_ClipVisSprite (vissprite_t *vis, int xl, int xh); void R_ClipVisSprite (vissprite_t *vis, int xl, int xh);

View file

@ -426,16 +426,16 @@ BYTE *GetBlendMap(PalEntry blend, BYTE *blendwork)
switch (blend.a==0 ? blend.r : -1) switch (blend.a==0 ? blend.r : -1)
{ {
case BLEND_INVERSEMAP: case BLEND_INVERSEMAP:
return InverseColormap; return SpecialColormaps[INVERSECOLORMAP];
case BLEND_GOLDMAP: case BLEND_GOLDMAP:
return GoldColormap; return SpecialColormaps[GOLDCOLORMAP];
case BLEND_REDMAP: case BLEND_REDMAP:
return RedColormap; return SpecialColormaps[REDCOLORMAP];
case BLEND_GREENMAP: case BLEND_GREENMAP:
return GreenColormap; return SpecialColormaps[GREENCOLORMAP];
case BLEND_ICEMAP: case BLEND_ICEMAP:
return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap; return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap;

View file

@ -341,6 +341,8 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
parms->style.BlendOp = 255; // Dummy "not set" value parms->style.BlendOp = 255; // Dummy "not set" value
parms->masked = true; parms->masked = true;
parms->bilinear = false; parms->bilinear = false;
parms->specialcolormap = NULL;
parms->colormapstyle = NULL;
parms->x = x << FRACBITS; parms->x = x << FRACBITS;
parms->y = y << FRACBITS; parms->y = y << FRACBITS;
@ -580,6 +582,14 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
case DTA_RenderStyle: case DTA_RenderStyle:
parms->style.AsDWORD = va_arg (tags, DWORD); parms->style.AsDWORD = va_arg (tags, DWORD);
break; break;
case DTA_SpecialColormap:
parms->specialcolormap = va_arg (tags, FSpecialColormapParameters *);
break;
case DTA_ColormapStyle:
parms->colormapstyle = va_arg (tags, FColormapStyle *);
break;
} }
tag = va_arg (tags, DWORD); tag = va_arg (tags, DWORD);
} }

View file

@ -61,15 +61,29 @@ extern "C" {
FDynamicColormap NormalLight; FDynamicColormap NormalLight;
} }
FPalette GPalette; FPalette GPalette;
BYTE InverseColormap[256]; BYTE SpecialColormaps[NUM_SPECIALCOLORMAPS][256];
BYTE GoldColormap[256];
// [BC] New Skulltag colormaps.
BYTE RedColormap[256];
BYTE GreenColormap[256];
BYTE BlueColormap[256];
BYTE DesaturateColormap[31][256]; BYTE DesaturateColormap[31][256];
static void FreeSpecialLights();; FSpecialColormapParameters SpecialColormapParms[NUM_SPECIALCOLORMAPS] =
{
// Doom invulnerability is an inverted grayscale.
// Strife uses it when firing the Sigil
{ { 1, 1, 1 }, true },
// Heretic invulnerability is a golden shade.
{ { 1.5, 0.75, 0 }, false },
// [BC] Build the Doomsphere colormap. It is red!
{ { 1.5, 0, 0 }, false },
// [BC] Build the Guardsphere colormap. It's a greenish-white kind of thing.
{ { 1.25, 1.5, 1 }, false },
// Build a blue colormap.
{ { 0, 0, 1.5 }, false },
};
static void FreeSpecialLights();
FColorMatcher ColorMatcher; FColorMatcher ColorMatcher;
@ -385,66 +399,30 @@ void InitPalette ()
// NormalLight.Maps is set by R_InitColormaps() // NormalLight.Maps is set by R_InitColormaps()
// build special maps (e.g. invulnerability) // build special maps (e.g. invulnerability)
int intensity; double intensity;
// Doom invulnerability is an inverted grayscale. for (int i = 0; i < countof(SpecialColormapParms); ++i)
// Strife uses it when firing the Sigil {
shade = InverseColormap; double r, g, b;
bool inv;
shade = SpecialColormaps[i];
r = SpecialColormapParms[i].Colorize[0];
g = SpecialColormapParms[i].Colorize[1];
b = SpecialColormapParms[i].Colorize[2];
inv = SpecialColormapParms[i].Inverted;
for (c = 0; c < 256; c++) for (c = 0; c < 256; c++)
{ {
intensity = (65535 - intensity = (GPalette.BaseColors[c].r * 77 +
(GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 + GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37)) >> 8; GPalette.BaseColors[c].b * 37) / 256.0;
shade[c] = ColorMatcher.Pick (intensity, intensity, intensity); if (inv)
{
intensity = 255 - intensity;
} }
shade[c] = ColorMatcher.Pick(
// Heretic invulnerability is a golden shade. MIN(255, int(intensity*r)), MIN(255, int(intensity*g)), MIN(255, int(intensity*b)));
shade = GoldColormap;
for (c = 0; c < 256; c++)
{
intensity = GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37;
shade[c] = ColorMatcher.Pick (
MIN (255, (intensity+intensity/2)>>8), intensity>>8, 0);
} }
// [BC] Build the Doomsphere colormap. It is red!
shade = RedColormap;
for (c = 0; c < 256; c++)
{
intensity = ((GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37));
shade[c] = ColorMatcher.Pick (
MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ), 0, 0 );
}
// [BC] Build the Guardsphere colormap. It's a greenish-white kind of thing.
shade = GreenColormap;
for (c = 0; c < 256; c++)
{
intensity = GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37;
shade[c] = ColorMatcher.Pick (
MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ),
MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ),
intensity>>8 );
}
// Build a blue colormap.
shade = BlueColormap;
for (c = 0; c < 256; c++)
{
intensity = ((GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37));
shade[c] = ColorMatcher.Pick (0, 0,
MIN( 255, ( intensity + ( intensity / 2 )) >> 8 ));
} }
// desaturated colormaps // desaturated colormaps
@ -453,7 +431,7 @@ void InitPalette ()
shade = DesaturateColormap[m]; shade = DesaturateColormap[m];
for (c = 0; c < 256; c++) for (c = 0; c < 256; c++)
{ {
intensity = (GPalette.BaseColors[c].r * 77 + int intensity = (GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 + GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37) / 255; GPalette.BaseColors[c].b * 37) / 255;

View file

@ -79,18 +79,41 @@ struct FDynamicColormap
FDynamicColormap *Next; FDynamicColormap *Next;
}; };
extern BYTE InverseColormap[256]; // For hardware-accelerated weapon sprites in colored sectors
extern BYTE GoldColormap[256]; struct FColormapStyle
// [BC] New Skulltag colormaps. {
extern BYTE RedColormap[256]; PalEntry Color;
extern BYTE GreenColormap[256]; PalEntry Fade;
extern BYTE BlueColormap[256]; int Desaturate;
float FadeLevel;
};
// Special colormaps, like invulnerability.
enum
{
NOFIXEDCOLORMAP = -1,
INVERSECOLORMAP,
GOLDCOLORMAP,
REDCOLORMAP, // [BC] New Skulltag colormaps.
GREENCOLORMAP,
BLUECOLORMAP,
NUM_SPECIALCOLORMAPS
};
struct FSpecialColormapParameters
{
float Colorize[3];
bool Inverted;
};
extern FSpecialColormapParameters SpecialColormapParms[NUM_SPECIALCOLORMAPS];
extern BYTE SpecialColormaps[NUM_SPECIALCOLORMAPS][256];
extern BYTE DesaturateColormap[31][256]; extern BYTE DesaturateColormap[31][256];
extern FPalette GPalette; extern FPalette GPalette;
extern "C" { extern "C" {
extern FDynamicColormap NormalLight; extern FDynamicColormap NormalLight;
} }
// The color overlay to use for depleted items // The color overlay to use for depleted items
#define DIM_OVERLAY MAKEARGB(170,0,0,0) #define DIM_OVERLAY MAKEARGB(170,0,0,0)

View file

@ -1099,6 +1099,20 @@ bool DFrameBuffer::Begin2D (bool copy3d)
return false; return false;
} }
//==========================================================================
//
// DFrameBuffer :: DrawBlendingRect
//
// In hardware 2D modes, the blending rect needs to be drawn separately
// from transferring the 3D scene to video memory, because the weapon
// sprite is drawn on top of that.
//
//==========================================================================
void DFrameBuffer::DrawBlendingRect()
{
}
//========================================================================== //==========================================================================
// //
// DFrameBuffer :: CreateTexture // DFrameBuffer :: CreateTexture

View file

@ -101,6 +101,8 @@ enum
DTA_RenderStyle, // same as render style for actors DTA_RenderStyle, // same as render style for actors
DTA_ColorOverlay, // DWORD: ARGB to overlay on top of image; limited to black for software DTA_ColorOverlay, // DWORD: ARGB to overlay on top of image; limited to black for software
DTA_BilinearFilter, // bool: apply bilinear filtering to the image DTA_BilinearFilter, // bool: apply bilinear filtering to the image
DTA_SpecialColormap,// pointer to FSpecialColormapParameters (likely to be forever hardware-only)
DTA_ColormapStyle, // pointer to FColormapStyle (hardware-only)
// For DrawText calls: // For DrawText calls:
DTA_TextLen, // stop after this many characters, even if \0 not hit DTA_TextLen, // stop after this many characters, even if \0 not hit
@ -225,6 +227,8 @@ public:
INTBOOL masked; INTBOOL masked;
INTBOOL bilinear; INTBOOL bilinear;
FRenderStyle style; FRenderStyle style;
struct FSpecialColormapParameters *specialcolormap;
struct FColormapStyle *colormapstyle;
}; };
protected: protected:
@ -349,12 +353,16 @@ public:
// Begin 2D drawing operations. This is like Update, but it doesn't end // Begin 2D drawing operations. This is like Update, but it doesn't end
// the scene, and it doesn't present the image yet. If you are going to // the scene, and it doesn't present the image yet. If you are going to
// be covering the entire screen with 2D elements, then pass false to // be covering the entire screen with 2D elements, then pass false to
// avoid copying the software bufferer to the screen. // avoid copying the software buffer to the screen.
// Returns true if hardware-accelerated 2D has been entered, false if not. // Returns true if hardware-accelerated 2D has been entered, false if not.
virtual bool Begin2D(bool copy3d); virtual bool Begin2D(bool copy3d);
// DrawTexture calls after Begin2D use native textures. // DrawTexture calls after Begin2D use native textures.
// Draws the blending rectangle over the viewwindow if in hardware-
// accelerated 2D mode.
virtual void DrawBlendingRect();
// Create a native texture from a game texture. // Create a native texture from a game texture.
virtual FNativeTexture *CreateTexture(FTexture *gametex, bool wrapping); virtual FNativeTexture *CreateTexture(FTexture *gametex, bool wrapping);

View file

@ -68,6 +68,7 @@
#include "win32iface.h" #include "win32iface.h"
#include "doomstat.h" #include "doomstat.h"
#include "v_palette.h" #include "v_palette.h"
#include "w_wad.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -168,6 +169,7 @@ enum
BQF_WrapUV = 16, BQF_WrapUV = 16,
BQF_InvertSource = 32, BQF_InvertSource = 32,
BQF_DisableAlphaTest= 64, BQF_DisableAlphaTest= 64,
BQF_Desaturated = 128,
}; };
// Shaders for a buffered quad // Shaders for a buffered quad
@ -176,7 +178,9 @@ enum
BQS_PalTex, BQS_PalTex,
BQS_Plain, BQS_Plain,
BQS_RedToAlpha, BQS_RedToAlpha,
BQS_ColorOnly BQS_ColorOnly,
BQS_SpecialColormap,
BQS_InGameColormap,
}; };
// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
@ -207,7 +211,35 @@ extern cycle_t BlitCycles;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
#include "fb_d3d9_shaders.h" const char *const D3DFB::ShaderNames[D3DFB::NUM_SHADERS] =
{
"NormalColor.pso",
"NormalColorPal.pso",
"NormalColorInv.pso",
"NormalColorPalInv.pso",
"RedToAlpha.pso",
"RedToAlphaInv.pso",
"VertexColor.pso",
"SpecialColormap.pso",
"SpecialColormapInv.pso",
"SpecialColorMapPal.pso",
"SpecialColorMapPalInv.pso",
"InGameColormap.pso",
"InGameColormapDesat.pso",
"InGameColormapInv.pso",
"InGameColormapInvDesat.pso",
"InGameColormapPal.pso",
"InGameColormapPalDesat.pso",
"InGameColormapPalInv.pso",
"InGameColormapPalInvDesat.pso",
"BurnWipe.pso",
"GammaCorrection.pso",
};
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -221,6 +253,12 @@ CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
//==========================================================================
//
// D3DFB - Constructor
//
//==========================================================================
D3DFB::D3DFB (int width, int height, bool fullscreen) D3DFB::D3DFB (int width, int height, bool fullscreen)
: BaseWinFB (width, height) : BaseWinFB (width, height)
{ {
@ -236,15 +274,10 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
ScreenshotSurface = NULL; ScreenshotSurface = NULL;
FinalWipeScreen = NULL; FinalWipeScreen = NULL;
PaletteTexture = NULL; PaletteTexture = NULL;
PalTexShader = NULL; for (int i = 0; i < NUM_SHADERS; ++i)
InvPalTexShader = NULL; {
PalTexBilinearShader = NULL; Shaders[i] = NULL;
PlainShader = NULL; }
InvPlainShader = NULL;
RedToAlphaShader = NULL;
ColorOnlyShader = NULL;
GammaFixerShader = NULL;
BurnShader = NULL;
FBFormat = D3DFMT_UNKNOWN; FBFormat = D3DFMT_UNKNOWN;
PalFormat = D3DFMT_UNKNOWN; PalFormat = D3DFMT_UNKNOWN;
VSync = vid_vsync; VSync = vid_vsync;
@ -350,6 +383,12 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
} }
} }
//==========================================================================
//
// D3DFB - Destructor
//
//==========================================================================
D3DFB::~D3DFB () D3DFB::~D3DFB ()
{ {
ReleaseResources(); ReleaseResources();
@ -357,8 +396,15 @@ D3DFB::~D3DFB ()
delete[] QuadExtra; delete[] QuadExtra;
} }
//==========================================================================
//
// D3DFB :: SetInitialState
//
// Called after initial device creation and reset, when everything is set // Called after initial device creation and reset, when everything is set
// to D3D's defaults. // to D3D's defaults.
//
//==========================================================================
void D3DFB::SetInitialState() void D3DFB::SetInitialState()
{ {
AlphaBlendEnabled = FALSE; AlphaBlendEnabled = FALSE;
@ -398,9 +444,9 @@ void D3DFB::SetInitialState()
D3DDevice->SetGammaRamp(0, 0, &ramp); D3DDevice->SetGammaRamp(0, 0, &ramp);
} }
// Used by the inverse color shaders // This constant is used for grayscaling weights (.xyz) and color inversion (.w)
float ones[4] = { 1, 1, 1, 1 }; float weights[4] = { 77/256.f, 143/256.f, 37/256.f, 1 };
D3DDevice->SetPixelShaderConstantF(6, ones, 1); D3DDevice->SetPixelShaderConstantF(PSCONST_Weights, weights, 1);
// D3DRS_ALPHATESTENABLE defaults to FALSE // D3DRS_ALPHATESTENABLE defaults to FALSE
// D3DRS_ALPHAREF defaults to 0 // D3DRS_ALPHAREF defaults to 0
@ -410,6 +456,12 @@ void D3DFB::SetInitialState()
CurBorderColor = 0; CurBorderColor = 0;
} }
//==========================================================================
//
// D3DFB :: FillPresentParameters
//
//==========================================================================
void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync) void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync)
{ {
memset (pp, 0, sizeof(*pp)); memset (pp, 0, sizeof(*pp));
@ -427,7 +479,13 @@ void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, b
} }
} }
bool D3DFB::CreateResources () //==========================================================================
//
// D3DFB :: CreateResources
//
//==========================================================================
bool D3DFB::CreateResources()
{ {
Packs = NULL; Packs = NULL;
if (!Windowed) if (!Windowed)
@ -444,56 +502,28 @@ bool D3DFB::CreateResources ()
LOG2 ("Resize window to %dx%d\n", sizew, sizeh); LOG2 ("Resize window to %dx%d\n", sizew, sizeh);
VidResizing = true; VidResizing = true;
// Make sure the window has a border in windowed mode // Make sure the window has a border in windowed mode
SetWindowLong (Window, GWL_STYLE, WS_VISIBLE|WS_OVERLAPPEDWINDOW); SetWindowLong(Window, GWL_STYLE, WS_VISIBLE|WS_OVERLAPPEDWINDOW);
if (GetWindowLong (Window, GWL_EXSTYLE) & WS_EX_TOPMOST) if (GetWindowLong(Window, GWL_EXSTYLE) & WS_EX_TOPMOST)
{ {
// Direct3D 9 will apparently add WS_EX_TOPMOST to fullscreen windows, // Direct3D 9 will apparently add WS_EX_TOPMOST to fullscreen windows,
// and removing it is a little tricky. Using SetWindowLongPtr to clear it // and removing it is a little tricky. Using SetWindowLongPtr to clear it
// will not do the trick, but sending the window behind everything will. // will not do the trick, but sending the window behind everything will.
SetWindowPos (Window, HWND_BOTTOM, 0, 0, sizew, sizeh, SetWindowPos(Window, HWND_BOTTOM, 0, 0, sizew, sizeh,
SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE); SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE);
SetWindowPos (Window, HWND_TOP, 0, 0, 0, 0, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
} }
else else
{ {
SetWindowPos (Window, NULL, 0, 0, sizew, sizeh, SetWindowPos(Window, NULL, 0, 0, sizew, sizeh,
SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOZORDER); SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOZORDER);
} }
I_RestoreWindowedPos (); I_RestoreWindowedPos();
VidResizing = false; VidResizing = false;
} }
SM14 = false; if (!LoadShaders())
if (FAILED(D3DDevice->CreatePixelShader (PalTexShader20Def, &PalTexShader)) &&
(SM14 = true, FAILED(D3DDevice->CreatePixelShader (PalTexShader14Def, &PalTexShader))))
{ {
return false; return false;
} }
if (FAILED(D3DDevice->CreatePixelShader (InvPalTexShader20Def, &InvPalTexShader)) &&
(SM14 = true, FAILED(D3DDevice->CreatePixelShader (InvPalTexShader14Def, &InvPalTexShader))))
{
return false;
}
if (FAILED(D3DDevice->CreatePixelShader (PlainShaderDef, &PlainShader)) ||
FAILED(D3DDevice->CreatePixelShader (InvPlainShaderDef, &InvPlainShader)) ||
FAILED(D3DDevice->CreatePixelShader (RedToAlphaDef, &RedToAlphaShader)) ||
FAILED(D3DDevice->CreatePixelShader (ColorOnlyDef, &ColorOnlyShader)))
{
return false;
}
if (FAILED(D3DDevice->CreatePixelShader (GammaFixerDef, &GammaFixerShader)))
{
// Cannot print during screen creation.
// Printf ("Using Shader Model 1.4: Windowed mode gamma will not work.\n");
GammaFixerShader = NULL;
}
if (FAILED(D3DDevice->CreatePixelShader(PalTexBilinearDef, &PalTexBilinearShader)))
{
PalTexBilinearShader = PalTexShader;
}
if (FAILED(D3DDevice->CreatePixelShader (BurnShaderDef, &BurnShader)))
{
BurnShader = NULL;
}
if (!CreateFBTexture() || if (!CreateFBTexture() ||
!CreatePaletteTexture()) !CreatePaletteTexture())
{ {
@ -506,6 +536,62 @@ bool D3DFB::CreateResources ()
return true; return true;
} }
//==========================================================================
//
// D3DFB :: LoadShaders
//
// Returns true if all required shaders were loaded. (Gamma and burn wipe
// are the only ones not considered "required".)
//
//==========================================================================
bool D3DFB::LoadShaders()
{
static const char *const models[] = { "30/", "20/", "14/" };
FString shaderdir, shaderpath;
int model, i, lump;
// We determine the best available model simply by trying them all in
// order of decreasing preference.
for (model = 0; model < countof(models); ++model)
{
shaderdir = "shaders/d3d/sm";
shaderdir += models[model];
for (i = 0; i < NUM_SHADERS; ++i)
{
shaderpath = shaderdir;
shaderpath += ShaderNames[i];
lump = Wads.CheckNumForFullName(shaderpath);
if (lump >= 0)
{
FMemLump data = Wads.ReadLump(lump);
if (FAILED(D3DDevice->CreatePixelShader((DWORD *)data.GetMem(), &Shaders[i])) &&
i != SHADER_GammaCorrection && i != SHADER_BurnWipe)
{
break;
}
}
}
if (i == NUM_SHADERS)
{ // Success!
SM14 = (model == countof(models) - 1);
return true;
}
// Failure. Release whatever managed to load (which is probably nothing.)
for (i = 0; i < NUM_SHADERS; ++i)
{
SAFE_RELEASE( Shaders[i] );
}
}
return false;
}
//==========================================================================
//
// D3DFB :: ReleaseResources
//
//==========================================================================
void D3DFB::ReleaseResources () void D3DFB::ReleaseResources ()
{ {
I_SaveWindowedPos (); I_SaveWindowedPos ();
@ -515,22 +601,10 @@ void D3DFB::ReleaseResources ()
SAFE_RELEASE( ScreenshotSurface ); SAFE_RELEASE( ScreenshotSurface );
SAFE_RELEASE( ScreenshotTexture ); SAFE_RELEASE( ScreenshotTexture );
SAFE_RELEASE( PaletteTexture ); SAFE_RELEASE( PaletteTexture );
if (PalTexBilinearShader != NULL) for (int i = 0; i < NUM_SHADERS; ++i)
{ {
if (PalTexBilinearShader != PalTexShader) SAFE_RELEASE( Shaders[i] );
{
PalTexBilinearShader->Release();
} }
PalTexBilinearShader = NULL;
}
SAFE_RELEASE( PalTexShader );
SAFE_RELEASE( InvPalTexShader );
SAFE_RELEASE( PlainShader );
SAFE_RELEASE( InvPlainShader );
SAFE_RELEASE( RedToAlphaShader );
SAFE_RELEASE( ColorOnlyShader );
SAFE_RELEASE( GammaFixerShader );
SAFE_RELEASE( BurnShader );
if (ScreenWipe != NULL) if (ScreenWipe != NULL)
{ {
delete ScreenWipe; delete ScreenWipe;
@ -545,7 +619,14 @@ void D3DFB::ReleaseResources ()
GatheringWipeScreen = false; GatheringWipeScreen = false;
} }
//==========================================================================
//
// D3DFB :: ReleaseDefaultPoolItems
//
// Free resources created with D3DPOOL_DEFAULT. // Free resources created with D3DPOOL_DEFAULT.
//
//==========================================================================
void D3DFB::ReleaseDefaultPoolItems() void D3DFB::ReleaseDefaultPoolItems()
{ {
SAFE_RELEASE( FBTexture ); SAFE_RELEASE( FBTexture );
@ -563,6 +644,12 @@ void D3DFB::ReleaseDefaultPoolItems()
SAFE_RELEASE( IndexBuffer ); SAFE_RELEASE( IndexBuffer );
} }
//==========================================================================
//
// D3DFB :: Reset
//
//==========================================================================
bool D3DFB::Reset () bool D3DFB::Reset ()
{ {
D3DPRESENT_PARAMETERS d3dpp; D3DPRESENT_PARAMETERS d3dpp;
@ -881,7 +968,7 @@ void D3DFB::Update ()
} }
psgamma[2] = psgamma[1] = psgamma[0] = igamma; psgamma[2] = psgamma[1] = psgamma[0] = igamma;
psgamma[3] = 1; psgamma[3] = 1;
D3DDevice->SetPixelShaderConstantF(7, psgamma, 1); D3DDevice->SetPixelShaderConstantF(PSCONST_Gamma, psgamma, 1);
} }
if (NeedPalUpdate) if (NeedPalUpdate)
@ -971,7 +1058,7 @@ void D3DFB::Draw3DPart(bool copy3d)
D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, vid_hwaalines); D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, vid_hwaalines);
assert(OldRenderTarget == NULL); assert(OldRenderTarget == NULL);
if (TempRenderTexture != NULL && if (TempRenderTexture != NULL &&
((Windowed && GammaFixerShader && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling)) ((Windowed && Shaders[SHADER_GammaCorrection] && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling))
{ {
IDirect3DSurface9 *targetsurf; IDirect3DSurface9 *targetsurf;
if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &targetsurf))) if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &targetsurf)))
@ -989,7 +1076,7 @@ void D3DFB::Draw3DPart(bool copy3d)
SetTexture (0, FBTexture); SetTexture (0, FBTexture);
SetPaletteTexture(PaletteTexture, 256, BorderColor); SetPaletteTexture(PaletteTexture, 256, BorderColor);
SetPixelShader(PalTexShader); SetPixelShader(Shaders[SHADER_NormalColorPal]);
D3DDevice->SetFVF (D3DFVF_FBVERTEX); D3DDevice->SetFVF (D3DFVF_FBVERTEX);
memset(Constant, 0, sizeof(Constant)); memset(Constant, 0, sizeof(Constant));
SetAlphaBlend(D3DBLENDOP(0)); SetAlphaBlend(D3DBLENDOP(0));
@ -997,7 +1084,18 @@ void D3DFB::Draw3DPart(bool copy3d)
if (copy3d) if (copy3d)
{ {
FBVERTEX verts[4]; FBVERTEX verts[4];
CalcFullscreenCoords(verts, Accel2D, false, FlashColor0, FlashColor1); D3DCOLOR color0, color1;
if (Accel2D)
{
color0 = 0;
color1 = 0xFFFFFFF;
}
else
{
color0 = FlashColor0;
color1 = FlashColor1;
}
CalcFullscreenCoords(verts, Accel2D, false, color0, color1);
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
} }
} }
@ -1039,7 +1137,7 @@ void D3DFB::DoWindowedGamma()
D3DDevice->SetRenderTarget(0, OldRenderTarget); D3DDevice->SetRenderTarget(0, OldRenderTarget);
D3DDevice->SetFVF(D3DFVF_FBVERTEX); D3DDevice->SetFVF(D3DFVF_FBVERTEX);
SetTexture(0, TempRenderTexture); SetTexture(0, TempRenderTexture);
SetPixelShader((Windowed && GammaFixerShader != NULL) ? GammaFixerShader : PlainShader); SetPixelShader(Shaders[(Windowed && Shaders[SHADER_GammaCorrection]) ? SHADER_GammaCorrection : SHADER_NormalColor]);
SetAlphaBlend(D3DBLENDOP(0)); SetAlphaBlend(D3DBLENDOP(0));
EnableAlphaTest(FALSE); EnableAlphaTest(FALSE);
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
@ -2148,6 +2246,23 @@ bool D3DFB::Begin2D(bool copy3d)
return true; return true;
} }
//==========================================================================
//
// D3DFB :: DrawBlendingRect
//
// Call after Begin2D to blend the 3D view.
//
//==========================================================================
void D3DFB::DrawBlendingRect()
{
if (!In2D || !Accel2D)
{
return;
}
Dim(FlashColor, FlashAmount / 256.f, viewwindowx, viewwindowy, viewwidth, viewheight);
}
//========================================================================== //==========================================================================
// //
// D3DFB :: CreateTexture // D3DFB :: CreateTexture
@ -2278,7 +2393,7 @@ void D3DFB::EndLineBatch()
VertexBuffer->Unlock(); VertexBuffer->Unlock();
if (VertexPos > 0) if (VertexPos > 0)
{ {
SetPixelShader(ColorOnlyShader); SetPixelShader(Shaders[SHADER_VertexColor]);
SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
D3DDevice->SetStreamSource(0, VertexBuffer, 0, sizeof(FBVERTEX)); D3DDevice->SetStreamSource(0, VertexBuffer, 0, sizeof(FBVERTEX));
D3DDevice->DrawPrimitive(D3DPT_LINELIST, 0, VertexPos / 2); D3DDevice->DrawPrimitive(D3DPT_LINELIST, 0, VertexPos / 2);
@ -2357,7 +2472,7 @@ void D3DFB::DrawPixel(int x, int y, int palcolor, uint32 color)
float(x), float(y), 0, 1, color float(x), float(y), 0, 1, color
}; };
EndBatch(); // Draw out any batched operations. EndBatch(); // Draw out any batched operations.
SetPixelShader(ColorOnlyShader); SetPixelShader(Shaders[SHADER_VertexColor]);
SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
D3DDevice->DrawPrimitiveUP(D3DPT_POINTLIST, 1, &pt, sizeof(FBVERTEX)); D3DDevice->DrawPrimitiveUP(D3DPT_POINTLIST, 1, &pt, sizeof(FBVERTEX));
} }
@ -2845,26 +2960,39 @@ void D3DFB::EndQuadBatch()
// Set the pixel shader // Set the pixel shader
if (quad->ShaderNum == BQS_PalTex) if (quad->ShaderNum == BQS_PalTex)
{ {
if (!(quad->Flags & BQF_Bilinear)) SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ?
{ SHADER_NormalColorPalInv : SHADER_NormalColorPal]);
SetPixelShader((quad->Flags & BQF_InvertSource) ? InvPalTexShader : PalTexShader);
}
else
{
SetPixelShader(PalTexBilinearShader);
}
} }
else if (quad->ShaderNum == BQS_Plain) else if (quad->ShaderNum == BQS_Plain)
{ {
SetPixelShader((quad->Flags & BQF_InvertSource) ? InvPlainShader : PlainShader); SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ?
SHADER_NormalColorInv : SHADER_NormalColor]);
} }
else if (quad->ShaderNum == BQS_RedToAlpha) else if (quad->ShaderNum == BQS_RedToAlpha)
{ {
SetPixelShader(RedToAlphaShader); SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ?
SHADER_RedToAlphaInv : SHADER_RedToAlpha]);
} }
else if (quad->ShaderNum == BQS_ColorOnly) else if (quad->ShaderNum == BQS_ColorOnly)
{ {
SetPixelShader(ColorOnlyShader); SetPixelShader(Shaders[SHADER_VertexColor]);
}
else if (quad->ShaderNum == BQS_SpecialColormap)
{
int select;
select = !!(quad->Flags & BQF_InvertSource);
select |= !!(quad->Flags & BQF_Paletted) << 1;
SetPixelShader(Shaders[SHADER_SpecialColormap + select]);
}
else if (quad->ShaderNum == BQS_InGameColormap)
{
int select;
select = !!(quad->Flags & BQF_Desaturated);
select |= !!(quad->Flags & BQF_InvertSource) << 1;
select |= !!(quad->Flags & BQF_Paletted) << 2;
SetPixelShader(Shaders[SHADER_InGameColormap + select]);
} }
// Set the texture clamp addressing mode // Set the texture clamp addressing mode
@ -2983,7 +3111,47 @@ bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &
SetColorOverlay(parms.colorOverlay, alpha, color0, color1); SetColorOverlay(parms.colorOverlay, alpha, color0, color1);
if (style.Flags & STYLEF_ColorIsFixed) if (parms.specialcolormap != NULL)
{ // Emulate an invulnerability or similar colormap.
if (style.Flags & STYLEF_InvertSource)
{
quad.Flags |= BQF_InvertSource;
}
if (fmt == D3DFMT_L8)
{
quad.Flags |= BQF_GamePalette;
}
quad.ShaderNum = BQS_SpecialColormap;
color0 = D3DCOLOR_COLORVALUE(parms.specialcolormap->Colorize[0]/2,
parms.specialcolormap->Colorize[1]/2, parms.specialcolormap->Colorize[2]/2, 1);
color1 = 0;
}
else if (parms.colormapstyle != NULL)
{ // Emulate the fading from an in-game colormap (colorized, faded, and desaturated)
if (style.Flags & STYLEF_InvertSource)
{
quad.Flags |= BQF_InvertSource;
}
if (fmt == D3DFMT_L8)
{
quad.Flags |= BQF_GamePalette;
}
if (parms.colormapstyle->Desaturate != 0)
{
quad.Flags |= BQF_Desaturated;
}
quad.ShaderNum = BQS_InGameColormap;
color0 = D3DCOLOR_ARGB(parms.colormapstyle->Desaturate,
parms.colormapstyle->Color.r,
parms.colormapstyle->Color.g,
parms.colormapstyle->Color.b);
double fadelevel = parms.colormapstyle->FadeLevel;
color1 = D3DCOLOR_ARGB(DWORD((1 - fadelevel) * 255),
DWORD(parms.colormapstyle->Fade.r * fadelevel),
DWORD(parms.colormapstyle->Fade.g * fadelevel),
DWORD(parms.colormapstyle->Fade.b * fadelevel));
}
else if (style.Flags & STYLEF_ColorIsFixed)
{ {
if (style.Flags & STYLEF_InvertSource) if (style.Flags & STYLEF_InvertSource)
{ // Since the source color is a constant, we can invert it now { // Since the source color is a constant, we can invert it now
@ -3187,7 +3355,7 @@ void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR bo
if (SM14) if (SM14)
{ {
// Shader Model 1.4 only uses 256-color palettes. // Shader Model 1.4 only uses 256-color palettes.
SetConstant(2, 1.f, 0.5f / 256.f, 0, 0); SetConstant(PSCONST_PaletteMod, 1.f, 0.5f / 256.f, 0, 0);
if (border_color != 0 && CurBorderColor != border_color) if (border_color != 0 && CurBorderColor != border_color)
{ {
CurBorderColor = border_color; CurBorderColor = border_color;
@ -3208,13 +3376,14 @@ void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR bo
// The constant register c2 is used to hold the multiplier in the // The constant register c2 is used to hold the multiplier in the
// x part and the adder in the y part. // x part and the adder in the y part.
float fcount = 1 / float(count); float fcount = 1 / float(count);
SetConstant(2, pc * fcount, pal * fcount, 0, 0); SetConstant(PSCONST_PaletteMod, pc * fcount, pal * fcount, 0, 0);
} }
SetTexture(1, texture); SetTexture(1, texture);
} }
void D3DFB::SetPalTexBilinearConstants(PackingTexture *tex) void D3DFB::SetPalTexBilinearConstants(PackingTexture *tex)
{ {
#if 0
float con[8]; float con[8];
// Don't bother doing anything if the constants won't be used. // Don't bother doing anything if the constants won't be used.
@ -3233,4 +3402,5 @@ void D3DFB::SetPalTexBilinearConstants(PackingTexture *tex)
con[7] = con[3]; con[7] = con[3];
D3DDevice->SetPixelShaderConstantF(3, con, 2); D3DDevice->SetPixelShaderConstantF(3, con, 2);
#endif
} }

View file

@ -1,665 +0,0 @@
#define HLSL_SOURCE_CODE 0
#define SHADER_ASSEMBLY_CODE 0
// A paletted texture shader ------------------------------------------------
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
sampler1D Palette : register(s1);
float4 PaletteMod : register(c2);
float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float index = tex2D (Image, texCoord).x;
index = index * PaletteMod.x + PaletteMod.y;
float4 rgb = tex1D (Palette, index);
return Flash + rgb * InvFlash;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc paltex.ps /Tps_1_4 /LD /VnPalTexShader14Def /Fhpaltex.h
//
//
// Parameters:
//
// sampler2D Image;
// sampler1D Palette;
// float4 PaletteMod;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// PaletteMod c2 1
// Image s0 1
// Palette s1 1
//
ps_1_4
texld r0, t0
mad r0.xy, r0.x, c2.x, c2.y
phase
texld r1, r0
mad r0, r1, v1, v0
// approximately 4 instruction slots used (2 texture, 2 arithmetic)
#endif
const DWORD PalTexShader14Def[] =
{
0xffff0104, 0x0039fffe, 0x42415443, 0x0000001c, 0x000000ab, 0xffff0104,
0x00000003, 0x0000001c, 0x00000100, 0x000000a4, 0x00000058, 0x00000003,
0x00000001, 0x00000060, 0x00000000, 0x00000070, 0x00010003, 0x00000001,
0x00000078, 0x00000000, 0x00000088, 0x00020002, 0x00020001, 0x00000094,
0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001,
0x00000000, 0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001,
0x00000000, 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001,
0x00000001, 0x00000000, 0x315f7370, 0x4d00345f, 0x6f726369, 0x74666f73,
0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d,
0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x00000042,
0x800f0000, 0xb0e40000, 0x00000004, 0x80030000, 0x80000000, 0xa0000002,
0xa0550002, 0x0000fffd, 0x00000042, 0x800f0001, 0x80e40000, 0x00000004,
0x800f0000, 0x80e40001, 0x90e40001, 0x90e40000, 0x0000ffff
};
#if SHADER_ASSEMBLY_CODE
ps_2_0
dcl t0.xy
dcl v0
dcl v1
dcl_2d s0
dcl_2d s1
texld r0, t0, s0
mad r0.xy, r0.x, c2.x, c2.y
texld r0, r0, s1
mov r1, v1
mad r0, r0, r1, v0
mov oC0, r0
// approximately 6 instruction slots used (2 texture, 4 arithmetic)
#endif
const DWORD PalTexShader20Def[] =
{
0xffff0200, 0x0039fffe, 0x42415443, 0x0000001c, 0x000000ab, 0xffff0200,
0x00000003, 0x0000001c, 0x00000100, 0x000000a4, 0x00000058, 0x00000003,
0x00000001, 0x00000060, 0x00000000, 0x00000070, 0x00010003, 0x00000001,
0x00000078, 0x00000000, 0x00000088, 0x00020002, 0x00020001, 0x00000094,
0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001,
0x00000000, 0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001,
0x00000000, 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001,
0x00000001, 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73,
0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d,
0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x0200001f,
0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f,
0x80000000, 0x900f0001, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f,
0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
0x04000004, 0x80030000, 0x80000000, 0xa0000002, 0xa0550002, 0x03000042,
0x800f0000, 0x80e40000, 0xa0e40801, 0x02000001, 0x800f0001, 0x90e40001,
0x04000004, 0x800f0000, 0x80e40000, 0x80e40001, 0x90e40000, 0x02000001,
0x800f0800, 0x80e40000, 0x0000ffff
};
// An inverted paletted texture shader --------------------------------------
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
sampler1D Palette : register(s1);
float4 PaletteMod : register(c2);
float4 White : register(c6); // Preloaded with (1,1,1,0)
float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float index = tex2D (Image, texCoord).x;
index = index * PaletteMod.x + PaletteMod.y;
float4 rgb = tex1D (Palette, index);
rgb.xyz = White.xyz - rgb.xyz;
return Flash + rgb * InvFlash;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc paltex.ps /Tps_1_4 /LD /VnInvPalTexShader14Def /Fhinvpaltex.h
//
//
// Parameters:
//
// sampler2D Image;
// sampler1D Palette;
// float4 PaletteMod;
// float4 White;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// PaletteMod c2 1
// White c6 1
// Image s0 1
// Palette s1 1
//
ps_1_4
texld r0, t0
mad r0.xy, r0.x, c2.x, c2.y
phase
texld r1, r0
add r1.xyz, -r1, c6
mad r0, r1, v1, v0
// approximately 5 instruction slots used (2 texture, 3 arithmetic)
#endif
const DWORD InvPalTexShader14Def[] =
{
0xffff0104, 0x003ffffe, 0x42415443, 0x0000001c, 0x000000c5, 0xffff0104,
0x00000004, 0x0000001c, 0x00000100, 0x000000be, 0x0000006c, 0x00000003,
0x00000001, 0x00000074, 0x00000000, 0x00000084, 0x00010003, 0x00000001,
0x0000008c, 0x00000000, 0x0000009c, 0x00020002, 0x00020001, 0x000000a8,
0x00000000, 0x000000b8, 0x00060002, 0x00020001, 0x000000a8, 0x00000000,
0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, 0x00000000,
0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001, 0x00000000,
0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, 0x00000001,
0x00000000, 0x74696857, 0x73700065, 0x345f315f, 0x63694d00, 0x6f736f72,
0x28207466, 0x44202952, 0x39584433, 0x61685320, 0x20726564, 0x706d6f43,
0x72656c69, 0x312e3920, 0x37372e35, 0x30302e39, 0xab003030, 0x00000042,
0x800f0000, 0xb0e40000, 0x00000004, 0x80030000, 0x80000000, 0xa0000002,
0xa0550002, 0x0000fffd, 0x00000042, 0x800f0001, 0x80e40000, 0x00000002,
0x80070001, 0x81e40001, 0xa0e40006, 0x00000004, 0x800f0000, 0x80e40001,
0x90e40001, 0x90e40000, 0x0000ffff
};
#if SHADER_ASSEMBLY_CODE
ps_2_0
dcl t0.xy
dcl v0
dcl v1
dcl_2d s0
dcl_2d s1
texld r0, t0, s0
mad r0.xy, r0.x, c2.x, c2.y
texld r0, r0, s1
add r0.xyz, -r0, c6
mov r1, v1
mad r0, r0, r1, v0
mov oC0, r0
// approximately 7 instruction slots used (2 texture, 5 arithmetic)
#endif
const DWORD InvPalTexShader20Def[] =
{
0xffff0200, 0x003ffffe, 0x42415443, 0x0000001c, 0x000000c5, 0xffff0200,
0x00000004, 0x0000001c, 0x20000100, 0x000000be, 0x0000006c, 0x00000003,
0x00020001, 0x00000074, 0x00000000, 0x00000084, 0x00010003, 0x00060001,
0x0000008c, 0x00000000, 0x0000009c, 0x00020002, 0x000a0001, 0x000000a8,
0x00000000, 0x000000b8, 0x00060002, 0x001a0001, 0x000000a8, 0x00000000,
0x67616d49, 0xabab0065, 0x000c0004, 0x00010001, 0x00000001, 0x00000000,
0x656c6150, 0x00657474, 0x000b0004, 0x00010001, 0x00000001, 0x00000000,
0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001, 0x00000001,
0x00000000, 0x74696857, 0x73700065, 0x305f325f, 0x63694d00, 0x6f736f72,
0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f,
0x2072656c, 0x39312e39, 0x3934392e, 0x3131322e, 0xabab0031, 0x0200001f,
0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f,
0x80000000, 0x900f0001, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f,
0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
0x04000004, 0x80030000, 0x80000000, 0xa0000002, 0xa0550002, 0x03000042,
0x800f0000, 0x80e40000, 0xa0e40801, 0x03000002, 0x80070000, 0x81e40000,
0xa0e40006, 0x02000001, 0x800f0001, 0x90e40001, 0x04000004, 0x800f0000,
0x80e40000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000,
0x0000ffff
};
// A paletted texture shader that does bilinear filtering -------------------
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
sampler2D Palette : register(s1);
float4 PaletteMod : register(c2);
//#define texture_size_x 512.0f
//#define texture_size_y 256.0f
//#define texel_size_x 1.0f / 512.0f
//#define texel_size_y 1.0f / 256.0f
// texture_size_x, texture_size_y, 0, texel_size_x
float4 size_a : register(c3);
// 0, texel_size_y, texel_size_y, texel_size_x
float4 size_b : register(c4);
float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float2 f = frac (texCoord.xy * size_a/*float2(texture_size_x, texture_size_y)*/);
float4 t00 = tex2D(Image, texCoord);
float4 t10 = tex2D(Image, texCoord + size_a.wz/*float2(texel_size_x, 0)*/);
t00.x = t00.x * PaletteMod.x + PaletteMod.y;
t10.x = t10.x * PaletteMod.x + PaletteMod.y;
float4 c00 = tex2D(Palette, t00);
float4 c10 = tex2D(Palette, t10);
float4 cA = lerp(c00, c10, f.x);
float4 t01 = tex2D(Image, texCoord + size_b.xy/*float2(0, texel_size_y)*/);
float4 t11 = tex2D(Image, texCoord + size_b.wz/*float2(texel_size_x, texel_size_y)*/);
t01.x = t01.x * PaletteMod.x + PaletteMod.y;
t11.x = t11.x * PaletteMod.x + PaletteMod.y;
float4 c01 = tex2D(Palette, t01);
float4 c11 = tex2D(Palette, t11);
float4 cB = lerp(c01, c11, f.x);
return Flash + lerp(cA, cB, f.y) * InvFlash;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.19.949.2111
//
// fxc paltex_bilinear.ps /Tps_2_0 /VnPalTexBilinearDef /Fhpaltex_bilinear.h
//
//
// Parameters:
//
// sampler2D Image;
// sampler2D Palette;
// float4 PaletteMod;
// float4 size_a;
// float4 size_b;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// PaletteMod c2 1
// size_a c3 1
// size_b c4 1
// Image s0 1
// Palette s1 1
//
ps_2_0
dcl t0.xy
dcl v0
dcl v1
dcl_2d s0
dcl_2d s1
add r0.xy, t0, c4
add r1.xy, t0, c4.wzyx
add r2.xy, t0, c3.wzyx
texld r0, r0, s0
texld r1, r1, s0
texld r2, r2, s0
texld r3, t0, s0
mad r0.x, r0.x, c2.x, c2.y
mad r1.x, r1.x, c2.x, c2.y
mad r2.x, r2.x, c2.x, c2.y
mad r3.x, r3.x, c2.x, c2.y
texld r0, r0, s1
texld r1, r1, s1
texld r2, r2, s1
texld r3, r3, s1
mul r4.xy, t0, c3
frc r4.xy, r4
lrp r5, r4.x, r1, r0
lrp r0, r4.x, r2, r3
lrp r1, r4.y, r5, r0
mov r0, v1
mad r0, r1, r0, v0
mov oC0, r0
// approximately 23 instruction slots used (8 texture, 15 arithmetic)
#endif
const DWORD PalTexBilinearDef[] =
{
0xffff0200, 0x0042fffe, 0x42415443, 0x0000001c, 0x000000d1, 0xffff0200,
0x00000005, 0x0000001c, 0x20000100, 0x000000ca, 0x00000080, 0x00000003,
0x00020001, 0x00000088, 0x00000000, 0x00000098, 0x00010003, 0x00060001,
0x00000088, 0x00000000, 0x000000a0, 0x00020002, 0x000a0001, 0x000000ac,
0x00000000, 0x000000bc, 0x00030002, 0x000e0001, 0x000000ac, 0x00000000,
0x000000c3, 0x00040002, 0x00120001, 0x000000ac, 0x00000000, 0x67616d49,
0xabab0065, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x656c6150,
0x00657474, 0x656c6150, 0x4d657474, 0xab00646f, 0x00030001, 0x00040001,
0x00000001, 0x00000000, 0x657a6973, 0x7300615f, 0x5f657a69, 0x73700062,
0x305f325f, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c,
0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39312e39, 0x3934392e,
0x3131322e, 0xabab0031, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f,
0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0x900f0001, 0x0200001f,
0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000002,
0x80030000, 0xb0e40000, 0xa0e40004, 0x03000002, 0x80030001, 0xb0e40000,
0xa01b0004, 0x03000002, 0x80030002, 0xb0e40000, 0xa01b0003, 0x03000042,
0x800f0000, 0x80e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0x80e40001,
0xa0e40800, 0x03000042, 0x800f0002, 0x80e40002, 0xa0e40800, 0x03000042,
0x800f0003, 0xb0e40000, 0xa0e40800, 0x04000004, 0x80010000, 0x80000000,
0xa0000002, 0xa0550002, 0x04000004, 0x80010001, 0x80000001, 0xa0000002,
0xa0550002, 0x04000004, 0x80010002, 0x80000002, 0xa0000002, 0xa0550002,
0x04000004, 0x80010003, 0x80000003, 0xa0000002, 0xa0550002, 0x03000042,
0x800f0000, 0x80e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0x80e40001,
0xa0e40801, 0x03000042, 0x800f0002, 0x80e40002, 0xa0e40801, 0x03000042,
0x800f0003, 0x80e40003, 0xa0e40801, 0x03000005, 0x80030004, 0xb0e40000,
0xa0e40003, 0x02000013, 0x80030004, 0x80e40004, 0x04000012, 0x800f0005,
0x80000004, 0x80e40001, 0x80e40000, 0x04000012, 0x800f0000, 0x80000004,
0x80e40002, 0x80e40003, 0x04000012, 0x800f0001, 0x80550004, 0x80e40005,
0x80e40000, 0x02000001, 0x800f0000, 0x90e40001, 0x04000004, 0x800f0000,
0x80e40001, 0x80e40000, 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000,
0x0000ffff
};
// A shader that doesn't look up colors from a palette. ---------------------
// Can be used for RGB textures.
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float4 index = tex2D (Image, texCoord);
return Flash + index * InvFlash;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc plain.ps /Tps_1_1 /LD /VnPlainShaderDef /Fhplain.h
//
//
// Parameters:
//
// sampler2D Image;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// Image s0 1
//
ps_1_1
tex t0
mad r0, t0, v1, v0
// approximately 2 instruction slots used (1 texture, 1 arithmetic)
#endif
const DWORD PlainShaderDef[] =
{
0xffff0101, 0x0022fffe, 0x42415443, 0x0000001c, 0x0000004f, 0xffff0101,
0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000003,
0x00000001, 0x00000038, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004,
0x00010001, 0x00000001, 0x00000000, 0x315f7370, 0x4d00315f, 0x6f726369,
0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072,
0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00,
0x00000042, 0xb00f0000, 0x00000004, 0x800f0000, 0xb0e40000, 0x90e40001,
0x90e40000, 0x0000ffff
};
// A shader that inverts the source's colors --------------------------------
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
float4 White : register(c6); // Preloaded with (1,1,1,0)
float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float4 rgb = tex2D (Image, texCoord);
rgb.xyz = White.xyz - rgb.xyz;
return Flash + rgb * InvFlash;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc plain.ps /Tps_1_1 /LD /VnInvPlainShaderDef /Fhinvplain.h
//
//
// Parameters:
//
// sampler2D Image;
// float4 White;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// White c6 1
// Image s0 1
//
ps_1_1
tex t0
add t0.xyz, -t0, c6
mad r0, t0, v1, v0
// approximately 3 instruction slots used (1 texture, 2 arithmetic)
#endif
const DWORD InvPlainShaderDef[] =
{
0xffff0101, 0x002dfffe, 0x42415443, 0x0000001c, 0x0000007b, 0xffff0101,
0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000003,
0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00060002, 0x00020001,
0x00000064, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001,
0x00000001, 0x00000000, 0x74696857, 0xabab0065, 0x00030001, 0x00040001,
0x00000001, 0x00000000, 0x315f7370, 0x4d00315f, 0x6f726369, 0x74666f73,
0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072, 0x6c69706d,
0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00, 0x00000042,
0xb00f0000, 0x00000002, 0xb0070000, 0xb1e40000, 0xa0e40006, 0x00000004,
0x800f0000, 0xb0e40000, 0x90e40001, 0x90e40000, 0x0000ffff
};
// A shader that copies the red component to the alpha component ------------
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
float4 main (float2 texCoord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float4 color = tex2D (Image, texCoord);
color.a = color.r;
return Flash + color * InvFlash;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc redtoalpha.ps /Tps_1_4 /LD /VnRedToAlphaDef /Fhredtoalpha.h
//
//
// Parameters:
//
// sampler2D Image;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// Image s0 1
//
ps_1_4
texld r0, t0
mad r1.xyz, r0, v1, v0
+ mad r1.w, r0.x, v1.w, v0.w
mov r0, r1
// approximately 3 instruction slots used (1 texture, 2 arithmetic)
#endif
const DWORD RedToAlphaDef[] =
{
0xffff0104, 0x0022fffe, 0x42415443, 0x0000001c, 0x0000004f, 0xffff0104,
0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000003,
0x00000001, 0x00000038, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004,
0x00010001, 0x00000001, 0x00000000, 0x315f7370, 0x4d00345f, 0x6f726369,
0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168, 0x6f432072,
0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030, 0xababab00,
0x00000042, 0x800f0000, 0xb0e40000, 0x00000004, 0x80070001, 0x80e40000,
0x90e40001, 0x90e40000, 0x40000004, 0x80080001, 0x80000000, 0x90ff0001,
0x90ff0000, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff
};
// A shader that just returns the first color component from the vertex -----
#if HLSL_SOURCE_CODE
float4 main (float4 color : COLOR0) : COLOR
{
return color;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc coloronlyshader.ps /Tps_1_1 /LD /VnColorOnlyDef /Fhcoloronly.h
//
ps_1_1
mov r0, v0
// approximately 1 instruction slot used
#endif
const DWORD ColorOnlyDef[] =
{
0xffff0101, 0x0017fffe, 0x42415443, 0x0000001c, 0x00000023, 0xffff0101,
0x00000000, 0x00000000, 0x00000100, 0x0000001c, 0x315f7370, 0x4d00315f,
0x6f726369, 0x74666f73, 0x29522820, 0x44334420, 0x53203958, 0x65646168,
0x6f432072, 0x6c69706d, 0x39207265, 0x2e35312e, 0x2e393737, 0x30303030,
0xababab00, 0x00000001, 0x800f0000, 0x90e40000, 0x0000ffff
};
// A shader that just corrects gamma for windowed mode ----------------------
#if HLSL_SOURCE_CODE
sampler2D Image : register(s0);
float4 Gamma : register(c7);
float4 main (float2 texCoord : TEXCOORD0) : COLOR
{
float4 color = tex2D (Image, texCoord);
color.xyz = pow(color.xyz, Gamma.xyz);
return color;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.19.949.2111
//
// fxc gammafixer.ps /Tps_2_0 /VnGammaFixerDef /Fhgammafixer.h
//
//
// Parameters:
//
// float4 Gamma;
// sampler2D Image;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// Gamma c7 1
// Image s0 1
//
ps_2_0
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
log r1.x, r0.x
log r1.y, r0.y
log r1.z, r0.z
mul r1.xyz, r1, c7
exp r0.x, r1.x
exp r0.y, r1.y
exp r0.z, r1.z
mov oC0, r0
// approximately 9 instruction slots used (1 texture, 8 arithmetic)
#endif
const DWORD GammaFixerDef[] =
{
0xffff0200, 0x002cfffe, 0x42415443, 0x0000001c, 0x0000007b, 0xffff0200,
0x00000002, 0x0000001c, 0x20000100, 0x00000074, 0x00000044, 0x00070002,
0x001e0001, 0x0000004c, 0x00000000, 0x0000005c, 0x00000003, 0x00020001,
0x00000064, 0x00000000, 0x6d6d6147, 0xabab0061, 0x00030001, 0x00040001,
0x00000001, 0x00000000, 0x67616d49, 0xabab0065, 0x000c0004, 0x00010001,
0x00000001, 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73,
0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
0x2e392072, 0x392e3931, 0x322e3934, 0x00313131, 0x0200001f, 0x80000000,
0xb0030000, 0x0200001f, 0x90000000, 0xa00f0800, 0x03000042, 0x800f0000,
0xb0e40000, 0xa0e40800, 0x0200000f, 0x80010001, 0x80000000, 0x0200000f,
0x80020001, 0x80550000, 0x0200000f, 0x80040001, 0x80aa0000, 0x03000005,
0x80070001, 0x80e40001, 0xa0e40007, 0x0200000e, 0x80010000, 0x80000001,
0x0200000e, 0x80020000, 0x80550001, 0x0200000e, 0x80040000, 0x80aa0001,
0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
};
// The shader used by the burn effect screen wipe ---------------------------
#if HLSL_SOURCE_CODE
sampler2D NewScreen : register(s0);
sampler2D Burn : register(s1);
float4 main (float2 coord[2] : TEXCOORD0) : COLOR
{
float4 color = tex2D(NewScreen, coord[0]);
float4 alpha = tex2D(Burn, coord[1]);
color.a = alpha.r * 2;
return color;
}
#elif SHADER_ASSEMBLY_CODE
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.15.779.0000
//
// fxc burn.ps /Tps_1_4 /VnBurnShaderDef /Fhburn.h /LD
//
//
// Parameters:
//
// sampler2D Burn;
// sampler2D NewScreen;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// NewScreen s0 1
// Burn s1 1
//
ps_1_4
texld r0, t0
texld r1, t1
add r0.w, r1.x, r1.x
+ mov r0.xyz, r0
// approximately 3 instruction slots used (2 texture, 1 arithmetic)
#endif
const DWORD BurnShaderDef[] =
{
0xffff0104, 0x0029fffe, 0x42415443, 0x0000001c, 0x0000006d, 0xffff0104,
0x00000002, 0x0000001c, 0x00000100, 0x00000066, 0x00000044, 0x00010003,
0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00000003, 0x00000001,
0x0000004c, 0x00000000, 0x6e727542, 0xababab00, 0x000c0004, 0x00010001,
0x00000001, 0x00000000, 0x5377654e, 0x65657263, 0x7370006e, 0x345f315f,
0x63694d00, 0x6f736f72, 0x28207466, 0x44202952, 0x39584433, 0x61685320,
0x20726564, 0x706d6f43, 0x72656c69, 0x312e3920, 0x37372e35, 0x30302e39,
0xab003030, 0x00000042, 0x800f0000, 0xb0e40000, 0x00000042, 0x800f0001,
0xb0e40001, 0x00000002, 0x80080000, 0x80000001, 0x80000001, 0x40000001,
0x80070000, 0x80e40000, 0x0000ffff
};

View file

@ -164,7 +164,7 @@ bool D3DFB::WipeStartScreen(int type)
// Create another texture to copy the final wipe screen to so // Create another texture to copy the final wipe screen to so
// we can still gamma correct the wipe. Since this is just for // we can still gamma correct the wipe. Since this is just for
// gamma correction, it's okay to fail (though not desirable.) // gamma correction, it's okay to fail (though not desirable.)
if (PixelDoubling || (GammaFixerShader != NULL && Windowed)) if (PixelDoubling || (Shaders[SHADER_GammaCorrection] != NULL && Windowed))
{ {
if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &tsurf))) if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &tsurf)))
{ {
@ -384,7 +384,7 @@ bool D3DFB::Wiper_Crossfade::Run(int ticks, D3DFB *fb)
fb->D3DDevice->SetFVF(D3DFVF_FBVERTEX); fb->D3DDevice->SetFVF(D3DFVF_FBVERTEX);
fb->SetTexture(0, fb->FinalWipeScreen); fb->SetTexture(0, fb->FinalWipeScreen);
fb->SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); fb->SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
fb->SetPixelShader(fb->PlainShader); fb->SetPixelShader(fb->Shaders[SHADER_NormalColor]);
fb->D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); fb->D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
return Clock >= 32; return Clock >= 32;
@ -442,7 +442,7 @@ bool D3DFB::Wiper_Melt::Run(int ticks, D3DFB *fb)
fb->D3DDevice->SetFVF(D3DFVF_FBVERTEX); fb->D3DDevice->SetFVF(D3DFVF_FBVERTEX);
fb->SetTexture(0, fb->FinalWipeScreen); fb->SetTexture(0, fb->FinalWipeScreen);
fb->SetAlphaBlend(D3DBLENDOP(0)); fb->SetAlphaBlend(D3DBLENDOP(0));
fb->SetPixelShader(fb->PlainShader); fb->SetPixelShader(fb->Shaders[SHADER_NormalColor]);
fb->D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); fb->D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
int i, dy; int i, dy;
@ -504,7 +504,7 @@ D3DFB::Wiper_Burn::Wiper_Burn(D3DFB *fb)
Density = 4; Density = 4;
BurnTime = 0; BurnTime = 0;
memset(BurnArray, 0, sizeof(BurnArray)); memset(BurnArray, 0, sizeof(BurnArray));
if (fb->BurnShader == NULL || FAILED(fb->D3DDevice->CreateTexture(WIDTH, HEIGHT, 1, if (fb->Shaders[SHADER_BurnWipe] == NULL || FAILED(fb->D3DDevice->CreateTexture(WIDTH, HEIGHT, 1,
D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &BurnTexture, NULL))) D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &BurnTexture, NULL)))
{ {
BurnTexture = NULL; BurnTexture = NULL;
@ -593,7 +593,7 @@ bool D3DFB::Wiper_Burn::Run(int ticks, D3DFB *fb)
fb->SetTexture(0, fb->FinalWipeScreen); fb->SetTexture(0, fb->FinalWipeScreen);
fb->SetTexture(1, BurnTexture); fb->SetTexture(1, BurnTexture);
fb->SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); fb->SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
fb->SetPixelShader(fb->BurnShader); fb->SetPixelShader(fb->Shaders[SHADER_BurnWipe]);
fb->D3DDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); fb->D3DDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
if (fb->SM14) if (fb->SM14)
{ {

View file

@ -244,6 +244,7 @@ public:
void ReleaseScreenshotBuffer(); void ReleaseScreenshotBuffer();
void SetBlendingRect (int x1, int y1, int x2, int y2); void SetBlendingRect (int x1, int y1, int x2, int y2);
bool Begin2D (bool copy3d); bool Begin2D (bool copy3d);
void DrawBlendingRect ();
FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping); FNativeTexture *CreateTexture (FTexture *gametex, bool wrapping);
FNativePalette *CreatePalette (FRemapTable *remap); FNativePalette *CreatePalette (FRemapTable *remap);
void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags); void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags);
@ -290,9 +291,49 @@ private:
PackingTexture *Texture; PackingTexture *Texture;
}; };
enum
{
PSCONST_PaletteMod = 2,
PSCONST_Weights = 6,
PSCONST_Gamma = 7,
};
enum
{
SHADER_NormalColor,
SHADER_NormalColorPal,
SHADER_NormalColorInv,
SHADER_NormalColorPalInv,
SHADER_RedToAlpha,
SHADER_RedToAlphaInv,
SHADER_VertexColor,
SHADER_SpecialColormap,
SHADER_SpecialColormapInv,
SHADER_SpecialColorMapPal,
SHADER_SpecialColorMapPalInv,
SHADER_InGameColormap,
SHADER_InGameColormapDesat,
SHADER_InGameColormapInv,
SHADER_InGameColormapInvDesat,
SHADER_InGameColormapPal,
SHADER_InGameColormapPalDesat,
SHADER_InGameColormapPalInv,
SHADER_InGameColormapPalInvDesat,
SHADER_BurnWipe,
SHADER_GammaCorrection,
NUM_SHADERS
};
static const char *const ShaderNames[NUM_SHADERS];
void SetInitialState(); void SetInitialState();
bool CreateResources(); bool CreateResources();
void ReleaseResources(); void ReleaseResources();
bool LoadShaders();
bool CreateFBTexture(); bool CreateFBTexture();
bool CreatePaletteTexture(); bool CreatePaletteTexture();
bool CreateGrayPaletteTexture(); bool CreateGrayPaletteTexture();
@ -386,12 +427,7 @@ private:
int QuadBatchPos; int QuadBatchPos;
enum { BATCH_None, BATCH_Quads, BATCH_Lines } BatchType; enum { BATCH_None, BATCH_Quads, BATCH_Lines } BatchType;
IDirect3DPixelShader9 *PalTexShader, *PalTexBilinearShader, *InvPalTexShader; IDirect3DPixelShader9 *Shaders[NUM_SHADERS];
IDirect3DPixelShader9 *PlainShader, *InvPlainShader;
IDirect3DPixelShader9 *RedToAlphaShader;
IDirect3DPixelShader9 *ColorOnlyShader;
IDirect3DPixelShader9 *GammaFixerShader;
IDirect3DPixelShader9 *BurnShader;
IDirect3DSurface9 *OldRenderTarget; IDirect3DSurface9 *OldRenderTarget;
IDirect3DTexture9 *InitialWipeScreen, *FinalWipeScreen; IDirect3DTexture9 *InitialWipeScreen, *FinalWipeScreen;

View file

@ -0,0 +1,10 @@
cd sm14
call build.bat
cd ..\sm20
call build.bat
cd ..\sm30
call build.bat
cd ..

View file

@ -0,0 +1,116 @@
sampler2D Image : register(s0);
sampler1D Palette : register(s1);
float4 PaletteMod : register(c2);
float4 Weights : register(c6); // RGB->Gray weighting { 77/256.0, 143/256.0, 37/256.0, 1 }
float4 Gamma : register(c7);
float4 TextureLookup(float2 tex_coord)
{
#if PALTEX
float index = tex2D(Image, tex_coord).x;
index = index * PaletteMod.x + PaletteMod.y;
return tex1D(Palette, index);
#else
return tex2D(Image, tex_coord);
#endif
}
float4 Invert(float4 rgb)
{
#if INVERT
rgb.rgb = Weights.www - rgb.xyz;
#endif
return rgb;
}
float Grayscale(float4 rgb)
{
return dot(rgb.rgb, Weights.rgb);
}
float4 SampleTexture(float2 tex_coord)
{
return Invert(TextureLookup(tex_coord));
}
// Normal color calculation for most drawing modes.
float4 NormalColor(float2 tex_coord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
return Flash + SampleTexture(tex_coord) * InvFlash;
}
// Copy the red channel to the alpha channel. Pays no attention to palettes.
float4 RedToAlpha(float2 tex_coord : TEXCOORD0, float4 Flash : COLOR0, float4 InvFlash : COLOR1) : COLOR
{
float4 color = Invert(tex2D(Image, tex_coord));
color.a = color.r;
return Flash + color * InvFlash;
}
// Just return the value of c0.
float4 VertexColor(float4 color : COLOR0) : COLOR
{
return color;
}
// Emulate one of the special colormaps. (Invulnerability, gold, etc.)
float4 SpecialColormap(float2 tex_coord : TEXCOORD0, float4 icolor : COLOR0) : COLOR
{
// We can't store values greater than 1.0 in a color register, so we multiply
// intensity by 2 and expect the caller to divide icolor by 2.
float4 color = SampleTexture(tex_coord);
float intensity = 2 * Grayscale(color);
color.rgb = icolor.rgb * intensity;
return color;
}
// In-game colormap effect: fade to a particular color and multiply by another, with
// optional desaturation of the original color. Desaturation is packed into color.a.
// Fade level is packed int fade.a. Fade.rgb has been premultiplied by alpha.
float4 InGameColormap(float2 tex_coord : TEXCOORD0, float4 color : COLOR0, float4 fade : COLOR1) : COLOR
{
float4 rgb = SampleTexture(tex_coord);
// Desaturate
#if DESAT
float3 intensity;
float invdesat;
intensity.rgb = Grayscale(rgb) * color.a;
invdesat = Weights.w - color.a;
rgb.rgb = intensity + rgb * invdesat;
#endif
// Fade
rgb.rgb = rgb.rgb * fade.aaa + fade.rgb;
// Shade
rgb.rgb = rgb.rgb * color.rgb;
return rgb;
}
// Windowed gamma correction.
float4 GammaCorrection(float2 tex_coord : TEXCOORD0) : COLOR
{
float4 color = tex2D(Image, tex_coord);
color.rgb = pow(color.rgb, Gamma.rgb);
return color;
}
// The burn wipe effect.
sampler2D NewScreen : register(s0);
sampler2D Burn : register(s1);
float4 BurnWipe(float2 coord[2] : TEXCOORD0) : COLOR
{
float4 color = tex2D(NewScreen, coord[0]);
float4 alpha = tex2D(Burn, coord[1]);
color.a = alpha.r * 2;
return color;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,27 @@
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ENormalColor -DPALTEX=0 -DINVERT=0 /FoNormalColor.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ENormalColor -DPALTEX=0 -DINVERT=1 /FoNormalColorInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ENormalColor -DPALTEX=1 -DINVERT=0 /FoNormalColorPal.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ENormalColor -DPALTEX=1 -DINVERT=1 /FoNormalColorPalInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ERedToAlpha -DINVERT=0 /FoRedToAlpha.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ERedToAlpha -DINVERT=1 /FoRedToAlphaInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EVertexColor /FoVertexColor.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ESpecialColormap -DPALTEX=0 -DINVERT=0 /FoSpecialColormap.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ESpecialColormap -DPALTEX=0 -DINVERT=1 /FoSpecialColormapInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ESpecialColormap -DPALTEX=1 -DINVERT=0 /FoSpecialColormapPal.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /ESpecialColormap -DPALTEX=1 -DINVERT=1 /FoSpecialColormapPalInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=0 /FoInGameColormap.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=1 /FoInGameColormapDesat.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=0 /FoInGameColormapInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=1 /FoInGameColormapInvDesat.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=0 /FoInGameColormapPal.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=1 /FoInGameColormapPalDesat.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=0 /FoInGameColormapPalInv.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=1 /FoInGameColormapPalInvDesat.pso
fxc ..\shaders.ps /Tps_1_4 /LD -DPS14=1 /EBurnWipe /FoBurnWipe.pso
@rem PS1.4 does not support the pow instruction, so no windowed gamma correction for it.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,27 @@
fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=0 /FoNormalColor.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=1 /FoNormalColorInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=0 /FoNormalColorPal.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=1 /FoNormalColorPalInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ERedToAlpha -DINVERT=0 /FoRedToAlpha.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ERedToAlpha -DINVERT=1 /FoRedToAlphaInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EVertexColor /FoVertexColor.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=0 /FoSpecialColormap.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=1 /FoSpecialColormapInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=0 /FoSpecialColormapPal.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=1 /FoSpecialColormapPalInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=0 /FoInGameColormap.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=1 /FoInGameColormapDesat.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=0 /FoInGameColormapInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=1 /FoInGameColormapInvDesat.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=0 /FoInGameColormapPal.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=1 /FoInGameColormapPalDesat.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=0 /FoInGameColormapPalInv.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=1 /FoInGameColormapPalInvDesat.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EBurnWipe /FoBurnWipe.pso
fxc ..\shaders.ps /Tps_2_0 /O3 /EGammaCorrection /FoGammaCorrection.pso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,27 @@
fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=0 /FoNormalColor.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=0 -DINVERT=1 /FoNormalColorInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=0 /FoNormalColorPal.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ENormalColor -DPALTEX=1 -DINVERT=1 /FoNormalColorPalInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ERedToAlpha -DINVERT=0 /FoRedToAlpha.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ERedToAlpha -DINVERT=1 /FoRedToAlphaInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EVertexColor /FoVertexColor.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=0 /FoSpecialColormap.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=0 -DINVERT=1 /FoSpecialColormapInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=0 /FoSpecialColormapPal.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /ESpecialColormap -DPALTEX=1 -DINVERT=1 /FoSpecialColormapPalInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=0 /FoInGameColormap.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=0 -DDESAT=1 /FoInGameColormapDesat.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=0 /FoInGameColormapInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=0 -DINVERT=1 -DDESAT=1 /FoInGameColormapInvDesat.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=0 /FoInGameColormapPal.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=0 -DDESAT=1 /FoInGameColormapPalDesat.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=0 /FoInGameColormapPalInv.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EInGameColormap -DPALTEX=1 -DINVERT=1 -DDESAT=1 /FoInGameColormapPalInvDesat.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EBurnWipe /FoBurnWipe.pso
fxc ..\shaders.ps /Tps_3_0 /O3 /EGammaCorrection /FoGammaCorrection.pso

File diff suppressed because it is too large Load diff