Remove spriteshade global

This commit is contained in:
Magnus Norddahl 2017-01-09 14:46:57 +01:00
parent 3b5dc96f4a
commit 65fa807433
6 changed files with 12 additions and 16 deletions

View file

@ -88,8 +88,6 @@ namespace swrenderer
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
int spriteshade;
FTexture *WallSpriteTile; FTexture *WallSpriteTile;
// //
@ -198,7 +196,7 @@ bool R_ClipSpriteColumnWithPortals(vissprite_t* spr)
// R_ProjectSprite // R_ProjectSprite
// Generates a vissprite for a thing if it might be visible. // Generates a vissprite for a thing if it might be visible.
// //
void R_ProjectSprite (AActor *thing, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector) void R_ProjectSprite (AActor *thing, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int spriteshade)
{ {
double tr_x; double tr_x;
double tr_y; double tr_y;
@ -357,7 +355,7 @@ void R_ProjectSprite (AActor *thing, WaterFakeSide fakeside, F3DFloor *fakefloor
if ((renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) if ((renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
{ {
R_ProjectWallSprite(thing, pos, picnum, spriteScale, renderflags); R_ProjectWallSprite(thing, pos, picnum, spriteScale, renderflags, spriteshade);
return; return;
} }
@ -648,7 +646,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, WaterFakeSide fakeside)
// Well, now it will be done. // Well, now it will be done.
sec->validcount = validcount; sec->validcount = validcount;
spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight); int spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight);
// Handle all things in sector. // Handle all things in sector.
for(auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext) for(auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
@ -685,7 +683,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, WaterFakeSide fakeside)
if(rover->bottom.plane->ZatPoint(0., 0.) >= thing->Top()) fakeceiling = rover; if(rover->bottom.plane->ZatPoint(0., 0.) >= thing->Top()) fakeceiling = rover;
} }
} }
R_ProjectSprite (thing, fakeside, fakefloor, fakeceiling, sec); R_ProjectSprite (thing, fakeside, fakefloor, fakeceiling, sec, spriteshade);
fakeceiling = NULL; fakeceiling = NULL;
fakefloor = NULL; fakefloor = NULL;
} }
@ -1018,7 +1016,7 @@ void R_DrawSprite (vissprite_t *spr)
} }
else else
{ // diminished light { // diminished light
spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight); int spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
spr->Style.BaseColormap = mybasecolormap; spr->Style.BaseColormap = mybasecolormap;
spr->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade); spr->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade);
} }
@ -1349,7 +1347,7 @@ void R_DrawMaskedSingle (bool renew)
void R_DrawHeightPlanes(double height); // kg3D - fake planes void R_DrawHeightPlanes(double height); // kg3D - fake planes
void R_DrawMasked (void) void R_DrawMasked ()
{ {
R_CollectPortals(); R_CollectPortals();
R_SortVisSprites (DrewAVoxel ? sv_compare2d : sv_compare, firstvissprite - vissprites); R_SortVisSprites (DrewAVoxel ? sv_compare2d : sv_compare, firstvissprite - vissprites);

View file

@ -40,8 +40,6 @@ namespace swrenderer
extern FTexture *WallSpriteTile; extern FTexture *WallSpriteTile;
extern int spriteshade;
bool R_ClipSpriteColumnWithPortals(vissprite_t* spr); bool R_ClipSpriteColumnWithPortals(vissprite_t* spr);

View file

@ -147,7 +147,7 @@ namespace swrenderer
// get light level // get light level
lightnum = ((floorlight + ceilinglight) >> 1) + r_actualextralight; lightnum = ((floorlight + ceilinglight) >> 1) + r_actualextralight;
spriteshade = LIGHT2SHADE(lightnum) - 24 * FRACUNIT; int spriteshade = LIGHT2SHADE(lightnum) - 24 * FRACUNIT;
if (camera->player != NULL) if (camera->player != NULL)
{ {
@ -190,7 +190,7 @@ namespace swrenderer
if ((psp->GetID() != PSP_TARGETCENTER || CrosshairImage == nullptr) && psp->GetCaller() != nullptr) if ((psp->GetID() != PSP_TARGETCENTER || CrosshairImage == nullptr) && psp->GetCaller() != nullptr)
{ {
R_DrawPSprite(psp, camera, bobx, boby, wx, wy, r_TicFracF); R_DrawPSprite(psp, camera, bobx, boby, wx, wy, r_TicFracF, spriteshade);
} }
psp = psp->GetNext(); psp = psp->GetNext();
@ -200,7 +200,7 @@ namespace swrenderer
} }
} }
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac) void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade)
{ {
double tx; double tx;
int x1; int x1;

View file

@ -20,6 +20,6 @@ namespace swrenderer
void R_SetupPlayerSpriteScale(); void R_SetupPlayerSpriteScale();
void R_DrawPlayerSprites(); void R_DrawPlayerSprites();
void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac); void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade);
void R_DrawRemainingPlayerSprites(); void R_DrawRemainingPlayerSprites();
} }

View file

@ -58,7 +58,7 @@
namespace swrenderer namespace swrenderer
{ {
void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags) void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade)
{ {
FWallCoords wallc; FWallCoords wallc;
double x1, x2; double x1, x2;

View file

@ -17,7 +17,7 @@
namespace swrenderer namespace swrenderer
{ {
void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags); void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade);
void R_DrawWallSprite(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip); void R_DrawWallSprite(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip);
void R_WallSpriteColumn(int x, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip); void R_WallSpriteColumn(int x, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
} }