From 65fa8074332f712fe78724062addd53eea19db38 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 9 Jan 2017 14:46:57 +0100 Subject: [PATCH] Remove spriteshade global --- src/swrenderer/scene/r_things.cpp | 14 ++++++-------- src/swrenderer/scene/r_things.h | 2 -- src/swrenderer/things/r_playersprite.cpp | 6 +++--- src/swrenderer/things/r_playersprite.h | 2 +- src/swrenderer/things/r_wallsprite.cpp | 2 +- src/swrenderer/things/r_wallsprite.h | 2 +- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/swrenderer/scene/r_things.cpp b/src/swrenderer/scene/r_things.cpp index c6b7ef90f8..e3d4482444 100644 --- a/src/swrenderer/scene/r_things.cpp +++ b/src/swrenderer/scene/r_things.cpp @@ -88,8 +88,6 @@ namespace swrenderer fixed_t sky1scale; // [RH] Sky 1 scale factor fixed_t sky2scale; // [RH] Sky 2 scale factor -int spriteshade; - FTexture *WallSpriteTile; // @@ -198,7 +196,7 @@ bool R_ClipSpriteColumnWithPortals(vissprite_t* spr) // R_ProjectSprite // 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_y; @@ -357,7 +355,7 @@ void R_ProjectSprite (AActor *thing, WaterFakeSide fakeside, F3DFloor *fakefloor if ((renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) { - R_ProjectWallSprite(thing, pos, picnum, spriteScale, renderflags); + R_ProjectWallSprite(thing, pos, picnum, spriteScale, renderflags, spriteshade); return; } @@ -648,7 +646,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, WaterFakeSide fakeside) // Well, now it will be done. sec->validcount = validcount; - spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight); + int spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight); // Handle all things in sector. 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; } } - R_ProjectSprite (thing, fakeside, fakefloor, fakeceiling, sec); + R_ProjectSprite (thing, fakeside, fakefloor, fakeceiling, sec, spriteshade); fakeceiling = NULL; fakefloor = NULL; } @@ -1018,7 +1016,7 @@ void R_DrawSprite (vissprite_t *spr) } else { // diminished light - spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight); + int spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight); spr->Style.BaseColormap = mybasecolormap; 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_DrawMasked (void) +void R_DrawMasked () { R_CollectPortals(); R_SortVisSprites (DrewAVoxel ? sv_compare2d : sv_compare, firstvissprite - vissprites); diff --git a/src/swrenderer/scene/r_things.h b/src/swrenderer/scene/r_things.h index ae7acce456..f870c8f22f 100644 --- a/src/swrenderer/scene/r_things.h +++ b/src/swrenderer/scene/r_things.h @@ -40,8 +40,6 @@ namespace swrenderer extern FTexture *WallSpriteTile; -extern int spriteshade; - bool R_ClipSpriteColumnWithPortals(vissprite_t* spr); diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index bd45565775..3755236525 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -147,7 +147,7 @@ namespace swrenderer // get light level lightnum = ((floorlight + ceilinglight) >> 1) + r_actualextralight; - spriteshade = LIGHT2SHADE(lightnum) - 24 * FRACUNIT; + int spriteshade = LIGHT2SHADE(lightnum) - 24 * FRACUNIT; if (camera->player != NULL) { @@ -190,7 +190,7 @@ namespace swrenderer 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(); @@ -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; int x1; diff --git a/src/swrenderer/things/r_playersprite.h b/src/swrenderer/things/r_playersprite.h index 68e174654a..a96b916661 100644 --- a/src/swrenderer/things/r_playersprite.h +++ b/src/swrenderer/things/r_playersprite.h @@ -20,6 +20,6 @@ namespace swrenderer void R_SetupPlayerSpriteScale(); 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(); } diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index e04bdc6cbb..674bd12187 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -58,7 +58,7 @@ 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; double x1, x2; diff --git a/src/swrenderer/things/r_wallsprite.h b/src/swrenderer/things/r_wallsprite.h index 57b96db467..a3ed29170b 100644 --- a/src/swrenderer/things/r_wallsprite.h +++ b/src/swrenderer/things/r_wallsprite.h @@ -17,7 +17,7 @@ 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_WallSpriteColumn(int x, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip); }