- make r_ambientlight work globally for all games by performing adjustment engine-side.

This commit is contained in:
Mitchell Richters 2020-06-21 13:08:46 +10:00 committed by Christoph Oelckers
parent e29eb5bbed
commit 3325ef272e
7 changed files with 5 additions and 11 deletions

View file

@ -3277,7 +3277,7 @@ void viewDrawScreen(bool sceneonly)
}
memcpy(bakMirrorGotpic, gotpic + 510, 2);
memcpy(gotpic + 510, otherMirrorGotpic, 2);
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0) * (numplayers > 1 ? 1.f : r_ambientlightrecip));
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0));
int vc4, vc8;
getzsofslope(vcc, vd8, vd4, &vc8, &vc4);
if (vd0 >= vc4)
@ -3351,7 +3351,7 @@ void viewDrawScreen(bool sceneonly)
}
nSprite = nextspritestat[nSprite];
}
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0) * (numplayers > 1 ? 1.f : r_ambientlightrecip));
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0));
cA = (cA + interpolateangfix16(fix16_from_int(deliriumTurnO), fix16_from_int(deliriumTurn), gInterpolate)) & 0x7ffffff;
int vfc, vf8;
getzsofslope(nSectnum, cX, cY, &vfc, &vf8);

View file

@ -266,7 +266,7 @@ static void polymost_updaterotmat(void)
};
multiplyMatrix4f(matrix, tiltmatrix);
renderSetViewMatrix(matrix);
renderSetVisibility(g_visibility * fviewingrange * (4.f / (65536.f * 65536.f)));
renderSetVisibility(((float)(g_visibility) / r_ambientlight) * fviewingrange * (4.f / (65536.f * 65536.f)));
}
static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, int32_t method, const vec2_16_t& tilesiz);

View file

@ -343,13 +343,10 @@ CUSTOM_CVARD(Int, r_showfpsperiod, 0, 0, "time in seconds before averaging min a
if (self < 0 || self > 5) self = 1;
}
float r_ambientlightrecip;
CUSTOM_CVARD(Float, r_ambientlight, 1.0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "sets the global map light level")
{
if (self < 0.1f) self = 0.1f;
else if (self > 10.f) self = 10.f;
else r_ambientlightrecip = 1.f / self;
}
CVARD(Bool, r_shadows, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable sprite and model shadows")

View file

@ -115,7 +115,6 @@ EXTERN_CVAR(Int, playercolor)
EXTERN_CVAR(Int, playerteam)
extern bool gNoAutoLoad;
extern float r_ambientlightrecip;
extern int hud_statusbarrange; // will be set by the game's configuration setup.
bool G_ChangeHudLayout(int direction);
bool G_CheckAutorun(bool button);

View file

@ -650,7 +650,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
smoothRatio = 65536;
int const playerVis = pPlayer->visibility;
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis * (numplayers > 1 ? 1.f : r_ambientlightrecip));
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis);
CAMERA(sect) = pPlayer->cursectnum;

View file

@ -30,8 +30,6 @@ int32_t registerosdcommands(void);
void GAME_onshowosd(int shown);
void GAME_clearbackground(int numcols, int numrows);
//extern float r_ambientlight,r_ambientlightrecip;
extern const char *const ConsoleButtons[];
//extern uint32_t cl_cheatmask;

View file

@ -860,7 +860,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
pPlayer->visibility = ud.const_visibility;
int const playerVis = pPlayer->visibility;
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis * (numplayers > 1 ? 1.f : r_ambientlightrecip));
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis);
CAMERA(sect) = pPlayer->cursectnum;