- moved shadeToLight out of build.h.

This commit is contained in:
Christoph Oelckers 2021-03-25 09:13:16 +01:00
parent 957f7e9487
commit 168b0385cf
11 changed files with 24 additions and 27 deletions

View file

@ -190,17 +190,8 @@ EXTERN int32_t display_mirror;
EXTERN int32_t randomseed;
EXTERN int16_t numshades;
EXTERN uint8_t paletteloaded;
// Return type is int because this gets passed to variadic functions where structs may produce undefined behavior.
inline int shadeToLight(int shade)
{
shade = clamp(shade, 0, numshades-1);
int light = Scale(numshades-1-shade, 255, numshades-1);
return PalEntry(255,light,light,light);
}
EXTERN int32_t maxspritesonscreen;
enum {
@ -337,22 +328,8 @@ SPRITE VARIABLES:
be in some sector, and must have some kind of status that you define.
TILE VARIABLES:
NUMTILES - the number of tiles found TILES.DAT.
TIMING VARIABLES:
NUMFRAMES - The number of times the draw3dscreen function was called
since the engine was initialized. This helps to determine frame
rate. (Frame rate = numframes * 120 / I_GetBuildTime().)
OTHER VARIABLES:
STARTUMOST[320] is an array of the highest y-coordinates on each column
that my engine is allowed to write to. You need to set it only
once.
STARTDMOST[320] is an array of the lowest y-coordinates on each column
that my engine is allowed to write to. You need to set it only
once.
SINTABLE[2048] is a sin table with 2048 angles rather than the
normal 360 angles for higher precision. Also since SINTABLE is in
all integers, the range is multiplied by 16383, so instead of the
@ -454,7 +431,6 @@ int findwallbetweensectors(int sect1, int sect2);
inline int sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; }
int32_t getsectordist(vec2_t const in, int const sectnum, vec2_t * const out = nullptr);
extern const int16_t *chsecptr_onextwall;
int32_t checksectorpointer(int16_t i, int16_t sectnum);
#if !KRANDDEBUG
inline int32_t krand(void)

View file

@ -13,6 +13,7 @@
#ifndef ENGINE_PRIV_H
#define ENGINE_PRIV_H
extern int32_t globalpal, globalfloorpal;
extern tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1];
extern int32_t xdimen, xdimenscale, xdimscale, ydimen;
extern float fxdimen;

View file

@ -73,6 +73,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "automap.h"
#include "v_draw.h"
#include "gi.h"
#include "gamefuncs.h"
CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

View file

@ -98,4 +98,14 @@ inline int sectorofwall(int wallNum)
return -1;
}
extern int numshades;
// Return type is int because this gets passed to variadic functions where structs may produce undefined behavior.
inline int shadeToLight(int shade)
{
shade = clamp(shade, 0, numshades - 1);
int light = Scale(numshades - 1 - shade, 255, numshades - 1);
return PalEntry(255, light, light, light);
}

View file

@ -48,6 +48,7 @@
#include "../../glbackend/glbackend.h"
LookupTableInfo lookups;
int numshades;
//==========================================================================
//
@ -136,7 +137,6 @@ void paletteLoadFromDisk(void)
void LookupTableInfo::postLoadTables(void)
{
globalpal = 0;
GPalette.GenerateGlobalBrightmapFromColormap(getTable(0), numshades);
// Try to detect fullbright translations. Unfortunately this cannot be used to detect fade strength because of loss of color precision in the palette map.

View file

@ -165,7 +165,7 @@ inline void videoclearFade()
void videoTintBlood(int32_t r, int32_t g, int32_t b);
extern int32_t globalpal, globalfloorpal;
extern int numshades;
extern void paletteLoadFromDisk(void);

View file

@ -804,7 +804,12 @@ bool HWSkyboxPortal::AllowSSAO() { return false; } // [MK] sector skyboxes don't
//-----------------------------------------------------------------------------
bool HWSectorStackPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clipper)
{
auto state = mState;
// TODO: Handle recursion more intelligently
auto& state = mState;
if (state->renderdepth > r_mirror_recursions)
{
return false;
}
auto portal = origin;
auto &vp = di->Viewpoint;

View file

@ -41,6 +41,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "mapinfo.h"
#include "c_dispatch.h"
#include "gamestate.h"
#include "gamefuncs.h"
BEGIN_DUKE_NS

View file

@ -39,6 +39,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "texturemanager.h"
#include "c_dispatch.h"
#include "gamestate.h"
#include "gamefuncs.h"
BEGIN_DUKE_NS

View file

@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_draw.h"
#include "m_random.h"
#include "gstrings.h"
#include "gamefuncs.h"
#include <string>

View file

@ -50,6 +50,7 @@
#include "hw_cvars.h"
#include "gamestruct.h"
#include "gl_models.h"
#include "gamefuncs.h"
CVARD(Bool, hw_hightile, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable hightile texture rendering")
bool hw_int_useindexedcolortextures;