mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
- changed AlterWeaponSprite so that it doesn't take a full vissprite as parameter.
- FCoverageBuffer is only used in r_things.cpp, so its declaration does not need to be in a global header that's included everywhere. SVN r3258 (trunk)
This commit is contained in:
parent
03177090c0
commit
42091b1bb3
9 changed files with 136 additions and 126 deletions
|
@ -464,7 +464,7 @@ void APowerInvulnerable::EndEffect ()
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int APowerInvulnerable::AlterWeaponSprite (vissprite_t *vis)
|
int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis)
|
||||||
{
|
{
|
||||||
int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis);
|
int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis);
|
||||||
if (Owner != NULL)
|
if (Owner != NULL)
|
||||||
|
@ -655,7 +655,7 @@ void APowerInvisibility::EndEffect ()
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int APowerInvisibility::AlterWeaponSprite (vissprite_t *vis)
|
int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis)
|
||||||
{
|
{
|
||||||
int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis);
|
int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis);
|
||||||
// Blink if the powerup is wearing off
|
// Blink if the powerup is wearing off
|
||||||
|
|
|
@ -54,7 +54,7 @@ protected:
|
||||||
void InitEffect ();
|
void InitEffect ();
|
||||||
void DoEffect ();
|
void DoEffect ();
|
||||||
void EndEffect ();
|
void EndEffect ();
|
||||||
int AlterWeaponSprite (vissprite_t *vis);
|
int AlterWeaponSprite (visstyle_t *vis);
|
||||||
};
|
};
|
||||||
|
|
||||||
class APowerStrength : public APowerup
|
class APowerStrength : public APowerup
|
||||||
|
@ -76,7 +76,7 @@ protected:
|
||||||
void InitEffect ();
|
void InitEffect ();
|
||||||
void DoEffect ();
|
void DoEffect ();
|
||||||
void EndEffect ();
|
void EndEffect ();
|
||||||
int AlterWeaponSprite (vissprite_t *vis);
|
int AlterWeaponSprite (visstyle_t *vis);
|
||||||
// FRenderStyle OwnersNormalStyle;
|
// FRenderStyle OwnersNormalStyle;
|
||||||
// fixed_t OwnersNormalAlpha;
|
// fixed_t OwnersNormalAlpha;
|
||||||
};
|
};
|
||||||
|
|
|
@ -774,7 +774,7 @@ fixed_t AInventory::GetSpeedFactor ()
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int AInventory::AlterWeaponSprite (vissprite_t *vis)
|
int AInventory::AlterWeaponSprite (visstyle_t *vis)
|
||||||
{
|
{
|
||||||
if (Inventory != NULL)
|
if (Inventory != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
class player_t;
|
class player_t;
|
||||||
class FConfigFile;
|
class FConfigFile;
|
||||||
class AWeapon;
|
class AWeapon;
|
||||||
|
struct visstyle_t;
|
||||||
|
|
||||||
class FWeaponSlot
|
class FWeaponSlot
|
||||||
{
|
{
|
||||||
|
@ -132,7 +133,6 @@ enum
|
||||||
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
|
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vissprite_t;
|
|
||||||
|
|
||||||
class AInventory : public AActor
|
class AInventory : public AActor
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,7 @@ public:
|
||||||
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
|
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
|
||||||
virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive);
|
virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive);
|
||||||
virtual fixed_t GetSpeedFactor();
|
virtual fixed_t GetSpeedFactor();
|
||||||
virtual int AlterWeaponSprite (vissprite_t *vis);
|
virtual int AlterWeaponSprite (visstyle_t *vis);
|
||||||
|
|
||||||
virtual PalEntry GetBlend ();
|
virtual PalEntry GetBlend ();
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,14 @@
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
FAKED_Center,
|
||||||
|
FAKED_BelowFloor,
|
||||||
|
FAKED_AboveCeiling
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct drawseg_t
|
struct drawseg_t
|
||||||
{
|
{
|
||||||
seg_t* curline;
|
seg_t* curline;
|
||||||
|
|
63
src/r_defs.h
63
src/r_defs.h
|
@ -1042,72 +1042,13 @@ struct FMiniBSP
|
||||||
|
|
||||||
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
||||||
|
|
||||||
// A vissprite_t is a thing
|
// This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite
|
||||||
// that will be drawn during a refresh.
|
struct visstyle_t
|
||||||
// I.e. a sprite object that is partly visible.
|
|
||||||
struct vissprite_t
|
|
||||||
{
|
{
|
||||||
short x1, x2;
|
|
||||||
fixed_t cx; // for line side calculation
|
|
||||||
fixed_t gx, gy, gz; // origin in world coordinates
|
|
||||||
angle_t angle;
|
|
||||||
fixed_t gzb, gzt; // global bottom / top for silhouette clipping
|
|
||||||
fixed_t startfrac; // horizontal position of x1
|
|
||||||
fixed_t xscale, yscale;
|
|
||||||
fixed_t xiscale; // negative if flipped
|
|
||||||
fixed_t depth;
|
|
||||||
fixed_t idepth; // 1/z
|
|
||||||
fixed_t texturemid;
|
|
||||||
DWORD FillColor;
|
|
||||||
lighttable_t *colormap;
|
lighttable_t *colormap;
|
||||||
sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling
|
|
||||||
sector_t *sector; // [RH] sector this sprite is in
|
|
||||||
F3DFloor *fakefloor;
|
|
||||||
F3DFloor *fakeceiling;
|
|
||||||
fixed_t alpha;
|
fixed_t alpha;
|
||||||
fixed_t floorclip;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
FTexture *pic;
|
|
||||||
struct FVoxel *voxel;
|
|
||||||
};
|
|
||||||
BYTE bIsVoxel:1; // [RH] Use voxel instead of pic
|
|
||||||
BYTE bSplitSprite:1; // [RH] Sprite was split by a drawseg
|
|
||||||
BYTE FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on
|
|
||||||
short renderflags;
|
|
||||||
DWORD Translation; // [RH] for color translation
|
|
||||||
FRenderStyle RenderStyle;
|
FRenderStyle RenderStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
FAKED_Center,
|
|
||||||
FAKED_BelowFloor,
|
|
||||||
FAKED_AboveCeiling
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
|
||||||
|
|
||||||
struct FCoverageBuffer
|
|
||||||
{
|
|
||||||
struct Span
|
|
||||||
{
|
|
||||||
Span *NextSpan;
|
|
||||||
short Start, Stop;
|
|
||||||
};
|
|
||||||
|
|
||||||
FCoverageBuffer(int size);
|
|
||||||
~FCoverageBuffer();
|
|
||||||
|
|
||||||
void Clear();
|
|
||||||
void InsertSpan(int listnum, int start, int stop);
|
|
||||||
Span *AllocSpan();
|
|
||||||
|
|
||||||
FMemArena SpanArena;
|
|
||||||
Span **Spans; // [0..NumLists-1] span lists
|
|
||||||
Span *FreeSpans;
|
|
||||||
unsigned int NumLists;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
||||||
|
|
||||||
//
|
//
|
||||||
// POV related.
|
// POV related.
|
||||||
//
|
//
|
||||||
|
|
138
src/r_things.cpp
138
src/r_things.cpp
|
@ -62,6 +62,28 @@
|
||||||
#include "r_data/colormaps.h"
|
#include "r_data/colormaps.h"
|
||||||
#include "r_data/voxels.h"
|
#include "r_data/voxels.h"
|
||||||
|
|
||||||
|
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
||||||
|
|
||||||
|
struct FCoverageBuffer
|
||||||
|
{
|
||||||
|
struct Span
|
||||||
|
{
|
||||||
|
Span *NextSpan;
|
||||||
|
short Start, Stop;
|
||||||
|
};
|
||||||
|
|
||||||
|
FCoverageBuffer(int size);
|
||||||
|
~FCoverageBuffer();
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
void InsertSpan(int listnum, int start, int stop);
|
||||||
|
Span *AllocSpan();
|
||||||
|
|
||||||
|
FMemArena SpanArena;
|
||||||
|
Span **Spans; // [0..NumLists-1] span lists
|
||||||
|
Span *FreeSpans;
|
||||||
|
unsigned int NumLists;
|
||||||
|
};
|
||||||
|
|
||||||
void R_DeinitSpriteData();
|
void R_DeinitSpriteData();
|
||||||
|
|
||||||
|
@ -316,9 +338,9 @@ void R_DrawVisSprite (vissprite_t *vis)
|
||||||
fixed_t xiscale;
|
fixed_t xiscale;
|
||||||
ESPSResult mode;
|
ESPSResult mode;
|
||||||
|
|
||||||
dc_colormap = vis->colormap;
|
dc_colormap = vis->Style.colormap;
|
||||||
|
|
||||||
mode = R_SetPatchStyle (vis->RenderStyle, vis->alpha, vis->Translation, vis->FillColor);
|
mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.alpha, vis->Translation, vis->FillColor);
|
||||||
|
|
||||||
if (mode != DontDraw)
|
if (mode != DontDraw)
|
||||||
{
|
{
|
||||||
|
@ -390,8 +412,8 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
// Do setup for blending.
|
// Do setup for blending.
|
||||||
dc_colormap = spr->colormap;
|
dc_colormap = spr->Style.colormap;
|
||||||
mode = R_SetPatchStyle(spr->RenderStyle, spr->alpha, spr->Translation, spr->FillColor);
|
mode = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.alpha, spr->Translation, spr->FillColor);
|
||||||
|
|
||||||
if (mode == DontDraw)
|
if (mode == DontDraw)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +433,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the voxel, either directly to the screen or offscreen.
|
// Render the voxel, either directly to the screen or offscreen.
|
||||||
R_DrawVoxel(spr->gx, spr->gy, spr->gz, spr->angle, spr->xscale, spr->yscale, spr->voxel, spr->colormap, cliptop, clipbot,
|
R_DrawVoxel(spr->gx, spr->gy, spr->gz, spr->angle, spr->xscale, spr->yscale, spr->voxel, spr->Style.colormap, cliptop, clipbot,
|
||||||
minslabz, maxslabz, flags);
|
minslabz, maxslabz, flags);
|
||||||
|
|
||||||
// Blend the voxel, if that's what we need to do.
|
// Blend the voxel, if that's what we need to do.
|
||||||
|
@ -753,11 +775,11 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
vis->gzt = gzt; // killough 3/27/98
|
vis->gzt = gzt; // killough 3/27/98
|
||||||
vis->renderflags = thing->renderflags;
|
vis->renderflags = thing->renderflags;
|
||||||
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
||||||
vis->RenderStyle = thing->RenderStyle;
|
vis->Style.RenderStyle = thing->RenderStyle;
|
||||||
vis->FillColor = thing->fillcolor;
|
vis->FillColor = thing->fillcolor;
|
||||||
vis->Translation = thing->Translation; // [RH] thing translation table
|
vis->Translation = thing->Translation; // [RH] thing translation table
|
||||||
vis->FakeFlatStat = fakeside;
|
vis->FakeFlatStat = fakeside;
|
||||||
vis->alpha = thing->alpha;
|
vis->Style.alpha = thing->alpha;
|
||||||
vis->fakefloor = fakefloor;
|
vis->fakefloor = fakefloor;
|
||||||
vis->fakeceiling = fakeceiling;
|
vis->fakeceiling = fakeceiling;
|
||||||
|
|
||||||
|
@ -775,9 +797,9 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
// The software renderer cannot invert the source without inverting the overlay
|
// The software renderer cannot invert the source without inverting the overlay
|
||||||
// too. That means if the source is inverted, we need to do the reverse of what
|
// too. That means if the source is inverted, we need to do the reverse of what
|
||||||
// the invert overlay flag says to do.
|
// the invert overlay flag says to do.
|
||||||
INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay);
|
INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay);
|
||||||
|
|
||||||
if (vis->RenderStyle.Flags & STYLEF_InvertSource)
|
if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource)
|
||||||
{
|
{
|
||||||
invertcolormap = !invertcolormap;
|
invertcolormap = !invertcolormap;
|
||||||
}
|
}
|
||||||
|
@ -785,12 +807,12 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
FDynamicColormap *mybasecolormap = basecolormap;
|
FDynamicColormap *mybasecolormap = basecolormap;
|
||||||
|
|
||||||
// Sprites that are added to the scene must fade to black.
|
// Sprites that are added to the scene must fade to black.
|
||||||
if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0)
|
if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0)
|
||||||
{
|
{
|
||||||
mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate);
|
mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vis->RenderStyle.Flags & STYLEF_FadeToBlack)
|
if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack)
|
||||||
{
|
{
|
||||||
if (invertcolormap)
|
if (invertcolormap)
|
||||||
{ // Fade to white
|
{ // Fade to white
|
||||||
|
@ -806,7 +828,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
// get light level
|
// get light level
|
||||||
if (fixedcolormap != NULL)
|
if (fixedcolormap != NULL)
|
||||||
{ // fixed map
|
{ // fixed map
|
||||||
vis->colormap = fixedcolormap;
|
vis->Style.colormap = fixedcolormap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -816,15 +838,15 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
}
|
}
|
||||||
if (fixedlightlev >= 0)
|
if (fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
vis->colormap = mybasecolormap->Maps + fixedlightlev;
|
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||||
}
|
}
|
||||||
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
||||||
{ // full bright
|
{ // full bright
|
||||||
vis->colormap = mybasecolormap->Maps;
|
vis->Style.colormap = mybasecolormap->Maps;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // diminished light
|
{ // diminished light
|
||||||
vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (
|
vis->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP (
|
||||||
(fixed_t)DivScale12 (r_SpriteVisibility, MAX(tz, MINZ)), spriteshade) << COLORMAPSHIFT);
|
(fixed_t)DivScale12 (r_SpriteVisibility, MAX(tz, MINZ)), spriteshade) << COLORMAPSHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1000,22 +1022,22 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
noaccel = false;
|
noaccel = false;
|
||||||
if (pspnum <= ps_flash)
|
if (pspnum <= ps_flash)
|
||||||
{
|
{
|
||||||
vis->alpha = owner->alpha;
|
vis->Style.alpha = owner->alpha;
|
||||||
vis->RenderStyle = owner->RenderStyle;
|
vis->Style.RenderStyle = owner->RenderStyle;
|
||||||
|
|
||||||
// The software renderer cannot invert the source without inverting the overlay
|
// The software renderer cannot invert the source without inverting the overlay
|
||||||
// too. That means if the source is inverted, we need to do the reverse of what
|
// too. That means if the source is inverted, we need to do the reverse of what
|
||||||
// the invert overlay flag says to do.
|
// the invert overlay flag says to do.
|
||||||
INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay);
|
INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay);
|
||||||
|
|
||||||
if (vis->RenderStyle.Flags & STYLEF_InvertSource)
|
if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource)
|
||||||
{
|
{
|
||||||
invertcolormap = !invertcolormap;
|
invertcolormap = !invertcolormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
FDynamicColormap *mybasecolormap = basecolormap;
|
FDynamicColormap *mybasecolormap = basecolormap;
|
||||||
|
|
||||||
if (vis->RenderStyle.Flags & STYLEF_FadeToBlack)
|
if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack)
|
||||||
{
|
{
|
||||||
if (invertcolormap)
|
if (invertcolormap)
|
||||||
{ // Fade to white
|
{ // Fade to white
|
||||||
|
@ -1030,7 +1052,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
|
|
||||||
if (realfixedcolormap != NULL)
|
if (realfixedcolormap != NULL)
|
||||||
{ // fixed color
|
{ // fixed color
|
||||||
vis->colormap = realfixedcolormap->Colormap;
|
vis->Style.colormap = realfixedcolormap->Colormap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1040,35 +1062,35 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
}
|
}
|
||||||
if (fixedlightlev >= 0)
|
if (fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
vis->colormap = mybasecolormap->Maps + fixedlightlev;
|
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||||
}
|
}
|
||||||
else if (!foggy && psp->state->GetFullbright())
|
else if (!foggy && psp->state->GetFullbright())
|
||||||
{ // full bright
|
{ // full bright
|
||||||
vis->colormap = mybasecolormap->Maps; // [RH] use basecolormap
|
vis->Style.colormap = mybasecolormap->Maps; // [RH] use basecolormap
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // local light
|
{ // local light
|
||||||
vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT);
|
vis->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (camera->Inventory != NULL)
|
if (camera->Inventory != NULL)
|
||||||
{
|
{
|
||||||
lighttable_t *oldcolormap = vis->colormap;
|
lighttable_t *oldcolormap = vis->Style.colormap;
|
||||||
camera->Inventory->AlterWeaponSprite (vis);
|
camera->Inventory->AlterWeaponSprite (&vis->Style);
|
||||||
if (vis->colormap != oldcolormap)
|
if (vis->Style.colormap != oldcolormap)
|
||||||
{
|
{
|
||||||
// The colormap has changed. Is it one we can easily identify?
|
// The colormap has changed. Is it one we can easily identify?
|
||||||
// If not, then don't bother trying to identify it for
|
// If not, then don't bother trying to identify it for
|
||||||
// hardware accelerated drawing.
|
// hardware accelerated drawing.
|
||||||
if (vis->colormap < SpecialColormaps[0].Colormap ||
|
if (vis->Style.colormap < SpecialColormaps[0].Colormap ||
|
||||||
vis->colormap > SpecialColormaps.Last().Colormap)
|
vis->Style.colormap > SpecialColormaps.Last().Colormap)
|
||||||
{
|
{
|
||||||
noaccel = true;
|
noaccel = true;
|
||||||
}
|
}
|
||||||
// Has the basecolormap changed? If so, we can't hardware accelerate it,
|
// Has the basecolormap changed? If so, we can't hardware accelerate it,
|
||||||
// since we don't know what it is anymore.
|
// since we don't know what it is anymore.
|
||||||
else if (vis->colormap < mybasecolormap->Maps ||
|
else if (vis->Style.colormap < mybasecolormap->Maps ||
|
||||||
vis->colormap >= mybasecolormap->Maps + NUMCOLORMAPS*256)
|
vis->Style.colormap >= mybasecolormap->Maps + NUMCOLORMAPS*256)
|
||||||
{
|
{
|
||||||
noaccel = true;
|
noaccel = true;
|
||||||
}
|
}
|
||||||
|
@ -1076,8 +1098,8 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
}
|
}
|
||||||
// If we're drawing with a special colormap, but shaders for them are disabled, do
|
// If we're drawing with a special colormap, but shaders for them are disabled, do
|
||||||
// not accelerate.
|
// not accelerate.
|
||||||
if (!r_shadercolormaps && (vis->colormap >= SpecialColormaps[0].Colormap &&
|
if (!r_shadercolormaps && (vis->Style.colormap >= SpecialColormaps[0].Colormap &&
|
||||||
vis->colormap <= SpecialColormaps.Last().Colormap))
|
vis->Style.colormap <= SpecialColormaps.Last().Colormap))
|
||||||
{
|
{
|
||||||
noaccel = true;
|
noaccel = true;
|
||||||
}
|
}
|
||||||
|
@ -1094,15 +1116,15 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VisPSpritesBaseColormap[pspnum] = basecolormap;
|
VisPSpritesBaseColormap[pspnum] = basecolormap;
|
||||||
vis->colormap = basecolormap->Maps;
|
vis->Style.colormap = basecolormap->Maps;
|
||||||
vis->RenderStyle = STYLE_Normal;
|
vis->Style.RenderStyle = STYLE_Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for hardware-assisted 2D. If it's available, and this sprite is not
|
// 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.
|
// fuzzy, don't draw it until after the switch to 2D mode.
|
||||||
if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
|
if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
|
||||||
{
|
{
|
||||||
FRenderStyle style = vis->RenderStyle;
|
FRenderStyle style = vis->Style.RenderStyle;
|
||||||
style.CheckFuzz();
|
style.CheckFuzz();
|
||||||
if (style.BlendOp != STYLEOP_Fuzz)
|
if (style.BlendOp != STYLEOP_Fuzz)
|
||||||
{
|
{
|
||||||
|
@ -1237,18 +1259,18 @@ void R_DrawRemainingPlayerSprites()
|
||||||
FColormapStyle colormapstyle;
|
FColormapStyle colormapstyle;
|
||||||
bool usecolormapstyle = false;
|
bool usecolormapstyle = false;
|
||||||
|
|
||||||
if (vis->colormap >= SpecialColormaps[0].Colormap &&
|
if (vis->Style.colormap >= SpecialColormaps[0].Colormap &&
|
||||||
vis->colormap < SpecialColormaps[SpecialColormaps.Size()].Colormap)
|
vis->Style.colormap < SpecialColormaps[SpecialColormaps.Size()].Colormap)
|
||||||
{
|
{
|
||||||
// Yuck! There needs to be a better way to store colormaps in the vissprite... :(
|
// Yuck! There needs to be a better way to store colormaps in the vissprite... :(
|
||||||
ptrdiff_t specialmap = (vis->colormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap);
|
ptrdiff_t specialmap = (vis->Style.colormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap);
|
||||||
special = &SpecialColormaps[specialmap];
|
special = &SpecialColormaps[specialmap];
|
||||||
}
|
}
|
||||||
else if (colormap->Color == PalEntry(255,255,255) &&
|
else if (colormap->Color == PalEntry(255,255,255) &&
|
||||||
colormap->Desaturate == 0)
|
colormap->Desaturate == 0)
|
||||||
{
|
{
|
||||||
overlay = colormap->Fade;
|
overlay = colormap->Fade;
|
||||||
overlay.a = BYTE(((vis->colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS);
|
overlay.a = BYTE(((vis->Style.colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1256,7 +1278,7 @@ void R_DrawRemainingPlayerSprites()
|
||||||
colormapstyle.Color = colormap->Color;
|
colormapstyle.Color = colormap->Color;
|
||||||
colormapstyle.Fade = colormap->Fade;
|
colormapstyle.Fade = colormap->Fade;
|
||||||
colormapstyle.Desaturate = colormap->Desaturate;
|
colormapstyle.Desaturate = colormap->Desaturate;
|
||||||
colormapstyle.FadeLevel = ((vis->colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS);
|
colormapstyle.FadeLevel = ((vis->Style.colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS);
|
||||||
}
|
}
|
||||||
screen->DrawTexture(vis->pic,
|
screen->DrawTexture(vis->pic,
|
||||||
viewwindowx + VisPSpritesX1[i],
|
viewwindowx + VisPSpritesX1[i],
|
||||||
|
@ -1271,8 +1293,8 @@ void R_DrawRemainingPlayerSprites()
|
||||||
DTA_ClipTop, viewwindowy,
|
DTA_ClipTop, viewwindowy,
|
||||||
DTA_ClipRight, viewwindowx + viewwidth,
|
DTA_ClipRight, viewwindowx + viewwidth,
|
||||||
DTA_ClipBottom, viewwindowy + viewheight,
|
DTA_ClipBottom, viewwindowy + viewheight,
|
||||||
DTA_Alpha, vis->alpha,
|
DTA_Alpha, vis->Style.alpha,
|
||||||
DTA_RenderStyle, vis->RenderStyle,
|
DTA_RenderStyle, vis->Style.RenderStyle,
|
||||||
DTA_FillColor, vis->FillColor,
|
DTA_FillColor, vis->FillColor,
|
||||||
DTA_SpecialColormap, special,
|
DTA_SpecialColormap, special,
|
||||||
DTA_ColorOverlay, overlay.d,
|
DTA_ColorOverlay, overlay.d,
|
||||||
|
@ -1493,7 +1515,7 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
int r1, r2;
|
int r1, r2;
|
||||||
short topclip, botclip;
|
short topclip, botclip;
|
||||||
short *clip1, *clip2;
|
short *clip1, *clip2;
|
||||||
lighttable_t *colormap = spr->colormap;
|
lighttable_t *colormap = spr->Style.colormap;
|
||||||
F3DFloor *rover;
|
F3DFloor *rover;
|
||||||
FDynamicColormap *mybasecolormap;
|
FDynamicColormap *mybasecolormap;
|
||||||
|
|
||||||
|
@ -1557,20 +1579,20 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
// found new values, recalculate
|
// found new values, recalculate
|
||||||
if (sec)
|
if (sec)
|
||||||
{
|
{
|
||||||
INTBOOL invertcolormap = (spr->RenderStyle.Flags & STYLEF_InvertOverlay);
|
INTBOOL invertcolormap = (spr->Style.RenderStyle.Flags & STYLEF_InvertOverlay);
|
||||||
|
|
||||||
if (spr->RenderStyle.Flags & STYLEF_InvertSource)
|
if (spr->Style.RenderStyle.Flags & STYLEF_InvertSource)
|
||||||
{
|
{
|
||||||
invertcolormap = !invertcolormap;
|
invertcolormap = !invertcolormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sprites that are added to the scene must fade to black.
|
// Sprites that are added to the scene must fade to black.
|
||||||
if (spr->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0)
|
if (spr->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0)
|
||||||
{
|
{
|
||||||
mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate);
|
mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->RenderStyle.Flags & STYLEF_FadeToBlack)
|
if (spr->Style.RenderStyle.Flags & STYLEF_FadeToBlack)
|
||||||
{
|
{
|
||||||
if (invertcolormap)
|
if (invertcolormap)
|
||||||
{ // Fade to white
|
{ // Fade to white
|
||||||
|
@ -1590,16 +1612,16 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
}
|
}
|
||||||
if (fixedlightlev >= 0)
|
if (fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
spr->colormap = mybasecolormap->Maps + fixedlightlev;
|
spr->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||||
}
|
}
|
||||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||||
{ // full bright
|
{ // full bright
|
||||||
spr->colormap = mybasecolormap->Maps;
|
spr->Style.colormap = mybasecolormap->Maps;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // diminished light
|
{ // diminished light
|
||||||
spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
|
spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
|
||||||
spr->colormap = mybasecolormap->Maps + (GETPALOOKUP (
|
spr->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP (
|
||||||
(fixed_t)DivScale12 (r_SpriteVisibility, spr->depth), spriteshade) << COLORMAPSHIFT);
|
(fixed_t)DivScale12 (r_SpriteVisibility, spr->depth), spriteshade) << COLORMAPSHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1750,7 +1772,7 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
|
|
||||||
if (topclip >= botclip)
|
if (topclip >= botclip)
|
||||||
{
|
{
|
||||||
spr->colormap = colormap;
|
spr->Style.colormap = colormap;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1864,7 +1886,7 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
}
|
}
|
||||||
if (i == x2)
|
if (i == x2)
|
||||||
{
|
{
|
||||||
spr->colormap = colormap;
|
spr->Style.colormap = colormap;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1872,7 +1894,7 @@ void R_DrawSprite (vissprite_t *spr)
|
||||||
int maxvoxely = spr->gzb > hzb ? INT_MAX : (spr->gzt - hzb) / spr->yscale;
|
int maxvoxely = spr->gzb > hzb ? INT_MAX : (spr->gzt - hzb) / spr->yscale;
|
||||||
R_DrawVisVoxel(spr, minvoxely, maxvoxely, cliptop, clipbot);
|
R_DrawVisVoxel(spr, minvoxely, maxvoxely, cliptop, clipbot);
|
||||||
}
|
}
|
||||||
spr->colormap = colormap;
|
spr->Style.colormap = colormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// kg3D:
|
// kg3D:
|
||||||
|
@ -2205,17 +2227,17 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
||||||
|
|
||||||
if (fixedlightlev >= 0)
|
if (fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
vis->colormap = map + fixedlightlev;
|
vis->Style.colormap = map + fixedlightlev;
|
||||||
}
|
}
|
||||||
else if (fixedcolormap)
|
else if (fixedcolormap)
|
||||||
{
|
{
|
||||||
vis->colormap = fixedcolormap;
|
vis->Style.colormap = fixedcolormap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Using MulScale15 instead of 16 makes particles slightly more visible
|
// Using MulScale15 instead of 16 makes particles slightly more visible
|
||||||
// than regular sprites.
|
// than regular sprites.
|
||||||
vis->colormap = map + (GETPALOOKUP (MulScale15 (tiz, r_SpriteVisibility),
|
vis->Style.colormap = map + (GETPALOOKUP (MulScale15 (tiz, r_SpriteVisibility),
|
||||||
shade) << COLORMAPSHIFT);
|
shade) << COLORMAPSHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2249,7 +2271,7 @@ void R_DrawParticle (vissprite_t *vis)
|
||||||
int spacing;
|
int spacing;
|
||||||
BYTE *dest;
|
BYTE *dest;
|
||||||
DWORD fg;
|
DWORD fg;
|
||||||
BYTE color = vis->colormap[vis->startfrac];
|
BYTE color = vis->Style.colormap[vis->startfrac];
|
||||||
int yl = vis->gzb;
|
int yl = vis->gzb;
|
||||||
int ycount = vis->gzt - yl + 1;
|
int ycount = vis->gzt - yl + 1;
|
||||||
int x1 = vis->x1;
|
int x1 = vis->x1;
|
||||||
|
|
|
@ -23,6 +23,43 @@
|
||||||
#ifndef __R_THINGS__
|
#ifndef __R_THINGS__
|
||||||
#define __R_THINGS__
|
#define __R_THINGS__
|
||||||
|
|
||||||
|
|
||||||
|
// A vissprite_t is a thing
|
||||||
|
// that will be drawn during a refresh.
|
||||||
|
// I.e. a sprite object that is partly visible.
|
||||||
|
|
||||||
|
struct vissprite_t
|
||||||
|
{
|
||||||
|
short x1, x2;
|
||||||
|
fixed_t cx; // for line side calculation
|
||||||
|
fixed_t gx, gy, gz; // origin in world coordinates
|
||||||
|
angle_t angle;
|
||||||
|
fixed_t gzb, gzt; // global bottom / top for silhouette clipping
|
||||||
|
fixed_t startfrac; // horizontal position of x1
|
||||||
|
fixed_t xscale, yscale;
|
||||||
|
fixed_t xiscale; // negative if flipped
|
||||||
|
fixed_t depth;
|
||||||
|
fixed_t idepth; // 1/z
|
||||||
|
fixed_t texturemid;
|
||||||
|
DWORD FillColor;
|
||||||
|
sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling
|
||||||
|
sector_t *sector; // [RH] sector this sprite is in
|
||||||
|
F3DFloor *fakefloor;
|
||||||
|
F3DFloor *fakeceiling;
|
||||||
|
fixed_t floorclip;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
FTexture *pic;
|
||||||
|
struct FVoxel *voxel;
|
||||||
|
};
|
||||||
|
BYTE bIsVoxel:1; // [RH] Use voxel instead of pic
|
||||||
|
BYTE bSplitSprite:1; // [RH] Sprite was split by a drawseg
|
||||||
|
BYTE FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on
|
||||||
|
short renderflags;
|
||||||
|
DWORD Translation; // [RH] for color translation
|
||||||
|
visstyle_t Style;
|
||||||
|
};
|
||||||
|
|
||||||
// [RH] Particle details
|
// [RH] Particle details
|
||||||
struct particle_t
|
struct particle_t
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue